yorko
yorko

Reputation: 1

Pythonanywhere - something went wrong - error running wsgi - modulenotfound error

I am new to django and I am doing a coursera course with little applications deployed on pythonanywhere, which has worked well so far. No I am stuck, because does not load at all. Pythonanywhere says that Something went wrong. This is the error log from pythonanywhere. Error running WSGI application ModuleNotFoundError: No module named 'django_extensions' This is my WSGI file

    """
WSGI config for mysite project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')

application = get_wsgi_application()

This is my settings.py file, not the entire one but the installed apps:

DEBUG = True

ALLOWED_HOSTS = ['*']

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'ads.apps.AdsConfig',
# Extensions - installed with pip3 / requirements.txt
    'django_extensions',
    'crispy_forms',
    'rest_framework',
    'social_django',
    'taggit',
    'home.apps.HomeConfig',
]

This is my urls.py, not the entire one, but the crucial part.

import os
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.views.static import serve

urlpatterns = [
    path('', include('home.urls')),  # Change to ads.urls
    path('ads/', include('ads.urls')),
    path('admin/', admin.site.urls),  # Keep
    path('accounts/', include('django.contrib.auth.urls')),  # Keep
#    url(r'^oauth/', include('social_django.urls', namespace='social')),  # Keep
]

I checked django version, requirements are installed. I double checked with pip list.

Running python3 manage.py check has no errors. I can do all mirgrations without errors. I don't know anymore where to look for the problem. I already did 3 or 4 of these mini applications and I did not have this problem. wsgi points to mysite.settings and the settings.py has django_extensions as INSTALLES APPS. What is the problem? Please help

Upvotes: 0

Views: 1536

Answers (1)

caseneuve
caseneuve

Reputation: 476

There are multiple Python versions installed on PythonAnywhere. Make sure that you installed the required module for the same Python environment that your web app is being run by. For example, if your web app is set to be run by Python 3.8, check if you installed the module with pip3.8 django_extensions --user command; if you are using a virtual environment, make sure it's set on the Web page and that you installed the module inside of that venv.

Upvotes: 0

Related Questions