[英]wsgi application name 'BASE_DIR' is not defined
I deployed django app on pythonanywhere.com.我在 pythonanywhere.com 上部署了 django 应用程序。 I am seeing this error.我看到了这个错误。 I searched a lot but didnt got anything.我搜索了很多,但没有得到任何东西。 I am stuck with wsgi and dont know what to do with it.我被 wsgi 困住了,不知道该怎么办。 please help请帮忙
2020-05-27 04:56:19,548: Error running WSGI application
2020-05-27 04:56:19,549: NameError: name 'BASE_DIR' is not defined
2020-05-27 04:56:19,549: File "/var/www/rashidtaha_pythonanywhere_com_wsgi.py", line 15, in <module>
2020-05-27 04:56:19,549: application = get_wsgi_application()
2020-05-27 04:56:19,549:
2020-05-27 04:56:19,549: File "/home/rashidtaha/.virtualenvs/rashidtaha.pythonanywhere.com/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2020-05-27 04:56:19,549: django.setup(set_prefix=False)
2020-05-27 04:56:19,549:
2020-05-27 04:56:19,549: File "/home/rashidtaha/.virtualenvs/rashidtaha.pythonanywhere.com/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
2020-05-27 04:56:19,549: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2020-05-27 04:56:19,550:
2020-05-27 04:56:19,550: File "/home/rashidtaha/.virtualenvs/rashidtaha.pythonanywhere.com/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__
2020-05-27 04:56:19,550: self._setup(name)
2020-05-27 04:56:19,550:
2020-05-27 04:56:19,550: File "/home/rashidtaha/.virtualenvs/rashidtaha.pythonanywhere.com/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup
2020-05-27 04:56:19,550: self._wrapped = Settings(settings_module)
2020-05-27 04:56:19,550:
2020-05-27 04:56:19,550: File "/home/rashidtaha/.virtualenvs/rashidtaha.pythonanywhere.com/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__
2020-05-27 04:56:19,550: mod = importlib.import_module(self.SETTINGS_MODULE)
2020-05-27 04:56:19,550:
2020-05-27 04:56:19,550: File "/home/rashidtaha/rashidtaha.pythonanywhere.com/env/lib/python3.8/site-packages/isort/__init__.py", line 25, in <module>
2020-05-27 04:56:19,551: from . import settings # noqa: F401
2020-05-27 04:56:19,551:
2020-05-27 04:56:19,551: File "/home/rashidtaha/rashidtaha.pythonanywhere.com/env/lib/python3.8/site-packages/isort/settings.py", line 359, in <module>
2020-05-27 04:56:19,551: STATIC_ROOT = os.path.join(BASE_DIR, 'static')
2020-05-27 04:56:19,551: ***************************************************
2020-05-27 04:56:19,551: If you're seeing an import error and don't know why,
2020-05-27 04:56:19,551: we have a dedicated help page to help you debug:
2020-05-27 04:56:19,551: https://help.pythonanywhere.com/pages/DebuggingImportError/
It sounds like BASE_DIR
isn't defined in the settings file.听起来BASE_DIR
没有在设置文件中定义。 Below depends somewhat on your project layout.下面在某种程度上取决于您的项目布局。 But this is what I'm using in of the projects.但这是我在项目中使用的。
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
It can be adapted if you would share your file structure.如果您要共享文件结构,则可以对其进行调整。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.