0

Djangoのサーバーが立ち上がりません。 解決方法をお願いします。

環境

  • Mac10.14.4(18E226) 
  • vscode
  • Miniconda
  • django

拡張機能

  • python
  • Django
  • AnacondaExtensionPack
  • MagicPython

(dj) watanabekeitanoMacBook-Pro:test3 watanabekeita$ conda list

# packages in environment at /miniconda3/envs/dj:
#
# Name                    Version                   Build  Channel
astroid                   2.2.5                    py37_0    conda-forge
autopep8                  1.4.4                      py_0    conda-forge
bzip2                     1.0.6             h1de35cc_1002    conda-forge
ca-certificates           2019.3.9             hecc5488_0    conda-forge
certifi                   2019.3.9                 py37_0    conda-forge
django                    2.2                      py37_0    conda-forge
isort                     4.3.17                   py37_0    conda-forge
lazy-object-proxy         1.3.1           py37h1de35cc_1000    conda-forge
libcxx                    8.0.0                         2    conda-forge
libcxxabi                 8.0.0                         2    conda-forge
libffi                    3.2.1             h6de7cb9_1006    conda-forge
mccabe                    0.6.1                      py_1    conda-forge
ncurses                   6.1               h0a44026_1002    conda-forge
openssl                   1.1.1b               h01d97ff_2    conda-forge
pip                       19.0.3                   py37_0    conda-forge
pycodestyle               2.5.0                      py_0    conda-forge
pylint                    2.3.1                    py37_0    conda-forge
python                    3.7.3                h0d93f26_0    conda-forge
pytz                      2019.1                     py_0    conda-forge
readline                  7.0               hcfe32e1_1001    conda-forge
setuptools                41.0.0                   py37_0    conda-forge
six                       1.12.0                py37_1000    conda-forge
sqlite                    3.26.0            h1765d9f_1001    conda-forge
tk                        8.6.9             ha441bb4_1001    conda-forge
wheel                     0.33.1                   py37_0    conda-forge
wrapt                     1.11.1           py37h1de35cc_0    conda-forge
xz                        5.2.4             h1de35cc_1001    conda-forge
zlib                      1.2.11            h1de35cc_1004    conda-forge

(dj) watanabekeitanoMacBook-Pro:Test3 watanabekeita$ python manage.py runserver

Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/miniconda3/envs/dj/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/miniconda3/envs/dj/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
    raise _exception[0](_exception[1]).with_traceback(_exception[2])
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/miniconda3/envs/dj/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
    class AbstractBaseUser(models.Model):
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/models/base.py", line 117, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/models/base.py", line 321, in add_to_class
    value.contribute_to_class(cls, name)
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/models/options.py", line 204, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/__init__.py", line 28, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/utils.py", line 201, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
    return import_module('%s.base' % backend_name)
  File "/miniconda3/envs/dj/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 28, in <module>
    from .introspection import DatabaseIntrospection            # isort:skip
  File "/miniconda3/envs/dj/lib/python3.7/site-packages/django/db/backends/sqlite3/introspection.py", line 4, in <module>
    import sqlparse
ModuleNotFoundError: No module named 'sqlparse'

1 件の回答 1

1

エラーの最後の文に、

ModuleNotFoundError: No module named 'sqlparse'
'sqlparse' というモジュールが見つかりません

という内容が書かれているので、 conda install sqlparse と実行してください。正常にインストールできれば、現在出ているエラーは解決します。

2
  • ありがとうございました!無事解決いたしました!またご縁があったらよろしくお願いします。
    – watakei
    Commented 2019年4月21日 9:11
  • この回答でよろしければ、承認済みとしてマーク(✓)をお願いします。
    – PicoSushi
    Commented 2019年4月22日 1:33

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。