'Settings.py returning ModuleNotFound error on app that exists
I am relatively new to Django and trying to create a simple app to enable a user to signup and login
However when I try to runserver to test what I currently have I run into this error message:
ModuleNotFoundError: No module named 'signup.app'
This is the structure of my project
peerprogrammingplat
--- peerprogrammingplat
--- signup
this is my installed apps in my settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'signup.app.SignupConfig',
]
my views.py
from .models import *
def register(response):
form = UserCreationForm()
return render(response, "signup/register.html", {"form":form})
urls.py
urlpatterns = [
path('admin/', admin.site.urls),
path('register/', signupv.register, name="register"),
]
Solution 1:[1]
you give the value in name in your ModelNameConfig.
in your apps.py in your app, you ll have something as following.
from django.apps import AppConfig
class SignUpConfig(AppConfig):
name = "signup" # this name value is given in your settings.py in INSTALLED_APP list.
something link
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'signup',
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | shivankgtm |
