after deploying site on heroku,it's showing Internal server error. for debug I made "debug=true" and I found this error:
"ModuleNotFoundError: No module named 'my_app.urls' "
I've added my app in installed app list
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'my_app',
]
my_project urls:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('my_app.urls'))
]
my_app urls:
from django.urls import path
from . import views
urlpatterns = [
path('',views.home ),
]
views.py:
from django.shortcuts import render
def home(request):
return render(request,'index.html')
site running on local server while debug = true
but not running while debug=false
(showing server error )
so how to fix this error "ModuleNotFoundError: No module named 'my_app.urls' "
What did I miss. Any help/suggestion will be highly appreciated. Thanks
you have to include your app information inside of your installed app section
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'my_app.apps.YOURAPPCONFIG NAME',
]
YOURAPPCONFIG NAME is in your apps.py, and copy the name of class and paste it.
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.