当我访问网址时,我无法获取新的Django应用程序 . 我刚收到“未找到请求的URL / spacegame /在此服务器上找不到 . ”错误 . 我在settings.py中安装了该应用,在主网址urls.py和app urls.py中设置了网址模式,并创建了应用视图.py . 它正在我的Django开发服务器上工作,但不在 生产环境 服务器上 . 我认为它也可能是nginx设置,但不确定 . 任何帮助将不胜感激 . 应用名称为“spacegame” .
主urls.py
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^$', include('homepageapp.urls')),
url(r'^spacegame/', include('spacegame.urls')),
url(r'^admin/', admin.site.urls)
]
spacegame.urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^spacegame/$', views.index, name='index')
]
spacegame.views.py
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the spacegame index.")
nginx conf
server {
listen 80;
server_name ::removed:: ;
return 301 https://$server_name$request_uri;
root /home/projects/aar/aarcom;
location = /favicon.ico {
access_log off; log_not_found off;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/projects/aar/aarcom/aarcom.sock;
}
location /static {
allow all;
alias /home/projects/aar/aarcom/static;
}
location ~ /.well-known {
allow all;
}
}