➜ mkdir front ➜ cd front ➜ npm init This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and save it as a dependency in the package.json file.
Press ^C at any time to quit. package name: (front) version: (1.0.0) description: front source entry point: (index.js) testcommand: git repository: keywords: author: moonwhite license: (ISC) About to write to /Users/yourusername/front/package.json:
classUserExtension(models.Model): school = models.CharField(max_length=100) user = models.OneToOneField("FrontUser",on_delete=models.CASCADE,related_name='extension')
# 通过extension来访问到UserExtension对象 user = FrontUser.objects.first() print(user.extension)
Collecting mysqlclient Using cached mysqlclient-2.0.1.tar.gz (87 kB) ...... File "/private/var/folders/7p/r7xrt8r50l1cd6dh0dtz2n940000gp/T/pycharm-packaging/mysqlclient/setup_posix.py", line 65, in get_config libs = mysql_config("libs") File "/private/var/folders/7p/r7xrt8r50l1cd6dh0dtz2n940000gp/T/pycharm-packaging/mysqlclient/setup_posix.py", line 31, in mysql_config raise OSError("{} not found".format(_mysql_config_path)) OSError: mysql_config not found ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 36, in <module> raise ImproperlyConfigured('mysqlclient 1.4.0 or newer is required; you have %s.' % Database.__version__) django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.0 or newer is required; you have 0.10.1.