我的网站的主应用程序在运行时未查看

问题描述 投票:0回答:1

enter image description here我无法启动我的网站。运行iPlanetHoster时显示以下错误。

ModuleNotFoundError at /home/massvnrc/myproject/myproject/myapp/templates/index.html
No module named '/myapp'
Request Method: GET
Request URL:    ***/home/massvnrc/myproject/myproject/myapp/templates/index.html
Django Version: 1.9.13
Exception Type: ModuleNotFoundError
Exception Value:    
No module named '/myapp'
Exception Location: /home/massvnrc/virtualenv/myproject/3.7/lib64/python3.7/importlib/__init__.py in import_module, line 127
Python Executable:  /home/massvnrc/virtualenv/myproject/3.7/bin/python3.7_bin
Python Version: 3.7.3
Python Path:    
['/home/massvnrc/myproject',
 '/opt/passenger-5.3.7-9.el7.cloudlinux/src/helper-scripts',
 '/home/massvnrc/virtualenv/myproject/3.7/lib64/python37.zip',
 '/home/massvnrc/virtualenv/myproject/3.7/lib64/python3.7',
 '/home/massvnrc/virtualenv/myproject/3.7/lib64/python3.7/lib-dynload',
 '/opt/alt/python37/lib64/python3.7',
 '/opt/alt/python37/lib/python3.7',
 '/home/massvnrc/virtualenv/myproject/3.7/lib/python3.7/site-packages']
Server time:    Thu, 23 Jan 2020 18:03:11 +0000

这里有一些图片显示了我的文件所在的位置。

在此处输入图像描述

有人可以告诉我为什么我得到这个错误

enter image description hereenter image description hereenter image description here

django python-3.x cpanel
1个回答
1
投票

您已在调试模式打开的情况下部署了网站-至少在没有限制访问权限的情况下,请勿这样做。无论如何,因此,我能够看到您的urls.py

from django.contrib import admin
from django.conf.urls import url, include
# from .import views
from django.contrib.auth import views as auth_views
urlpatterns = [
    url('admin/', admin.site.urls),
    url('', include('/myapp.urls')), ...
]

以及通过设置安装的应用程序:

INSTALLED_APPS  
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']

我没有在设置中注册myapp。您需要添加它。接下来是include('/myapp.urls')应该更改为include('myapp.urls')

© www.soinside.com 2019 - 2024. All rights reserved.