简体   繁体   中英

django-admin cannot find settings module

I'm trying to run django-admin runserver but I get this error:

    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'App'

I am using pipenv so I made a .env file in the cwd and I have the DJANGO_SETTINGS_MODULE pointing at src.App.settings I haven't made any sort of modifications, I believe, except running the server once with ./src/manage.py runserver (it automatically created an sqlite3 db). Here is the file structure image

I can run the server perfectly fine if I run it through manage.py though

You can use uwsgi to run a django project.

First install uwsgi using:

pip install uWSGI

Go to project folder and enter this in terminal:

Replace server with whatever is your project name

uwsgi --http :8000 --module Server.wsgi

if you are not interested in install another module then there is no way to runserver locally

This is a similar question that was asked, you can check it out.

https://stackoverflow.com/a/32199813/12640905

However, my guess is that the python installation that you're using isn't the same as the pip environment that you're installing the packages into.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM