django.core.exceptions.ImproperlyConfigured: WSGI

2020-07-07 05:20发布

The scenario is,

I cloned the Django code for OpenShift-V3 from here . When I run the code using python manage.py runserver getting an error as,

django.core.exceptions.ImproperlyConfigured: WSGI application 'application' could not be loaded; Error importing module: 'application doesn't look like a module path

I didn't add anything to the code and the required packages are already satisfied.

9条回答
成全新的幸福
2楼-- · 2020-07-07 05:39

If you run django project locally for development, just remove WSGI_APPLICATION variable from settings.py module. It needs in prod/stage settings, for example settings_prod.py

查看更多
一纸荒年 Trace。
3楼-- · 2020-07-07 05:39

Do you have Django Debug Toolbar

Remove it and check if the problem goes away. Possible occurences:

pip uninstall django-debug-toolbar

INSTALLED_APPS = [
    ...
    'debug_toolbar',
    ...
]

MIDDLEWARE = [
    ...
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    ...
]

查看更多
叛逆
4楼-- · 2020-07-07 05:41

Go to django-ex/project/settings.py

Change the line in settings.py as below

WSGI_APPLICATION = 'application' to WSGI_APPLICATION = 'wsgi.application'

That's it :(

查看更多
等我变得足够好
5楼-- · 2020-07-07 05:42

I used a middleware CorsMiddleware but forget to install it so after install, it works perfectly.

pip install django-cors-headers.

So check something like it you may miss something like it.

查看更多
三岁会撩人
6楼-- · 2020-07-07 05:42

note that any error in importing modules anywhere prior to starting the wsgi application will also prompt this message, so first look at the trace and start from the top in fixing issues.

I ported a Django app from python 2.7 to python3 and add all sorts of module import issues, not connected to this issue directly.

查看更多
Bombasti
7楼-- · 2020-07-07 05:45

Make sure you are in desired python Environment

Get the requirements.txt file or the python modules list, which are needed to execute django.

Install all the Modules and you shall be good to go.

查看更多
登录 后发表回答