Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ModuleNotFoundError:没有名为';我的应用程序URL';在django_Python_Django_Heroku - Fatal编程技术网

Python ModuleNotFoundError:没有名为';我的应用程序URL';在django

Python ModuleNotFoundError:没有名为';我的应用程序URL';在django,python,django,heroku,Python,Django,Heroku,在heroku上部署站点后,显示内部服务器错误。 对于调试,我设置了“debug=true”,并发现了以下错误: “ModuleNotFoundError:没有名为'my_app.url'的模块” 我已将我的应用添加到已安装的应用列表中 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django

在heroku上部署站点后,显示内部服务器错误。 对于调试,我设置了“debug=true”,并发现了以下错误:
“ModuleNotFoundError:没有名为'my_app.url'的模块”

我已将我的应用添加到已安装的应用列表中

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'my_app',
]
my_项目URL:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('',include('my_app.urls'))
 ]
我的应用程序URL:

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')
站点在本地服务器上运行,而
debug=true
但在调试=false时未运行(显示服务器错误)

那么如何修复这个错误“ModuleNotFoundError:没有名为'my_app.url'的模块”


我错过了什么。如有任何帮助/建议,将不胜感激。谢谢

Hi,在部署到heroku之前,您是否已经执行了pip freeze>requirements.txt?您好,我执行了,但我从那里删除了这两个东西“Twisted==21.o2.0”和“Twisted iocpsupport==1.0.1”“因为这两件事在部署时会导致错误…我需要安装它们吗?我的插件或软件包有问题,问题是虚拟环境,我使用的是pipenv,因此我必须执行pipenv安装xxx,而不是pip安装xxxx,然后执行pip冻结,我没有从你的问题中得到的是它在抱怨主应用程序,这是我从阅读你的问题中了解到的,对吗?我想你在我的项目URL中遗漏了这一点:从django.conf.url导入include,url你得到了另一个ModuleNofFoundError mpfol.wsgi我不知道那是什么,您在requirements.txt中看到了吗?