在此服务器上找不到URL - nginx django

时间:2017-08-20 19:31:18

标签: python django nginx

当我访问网址时,我无法获取新的Django应用。我刚收到“未找到”此服务器上未找到请求的URL / spacegame /。'错误。我安装了#39; settings.py中的应用程序,在主邮件urls.py和app urls.py中设置网址模式,并创建应用程序views.py。它正在我的Django开发服务器上工作,但不在生产服务器上。我认为它也可能是nginx设置,但不确定。任何帮助将不胜感激。应用名称是' spacegame'。

main 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;
        }
}

0 个答案:

没有答案
相关问题