gpt4 book ai didi

在/admin/中找不到 Django 管理页面

转载 作者:行者123 更新时间:2023-12-03 10:34:19 24 4
gpt4 key购买 nike

我只安装了apache和django。

django 默认页面工作正常:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.



但/admin/站点不是:

Not Found

The requested URL /admin/ was not found on this server.

Apache/2.2.17 (Ubuntu) Server at 69.162.92.53 Port 80



Apache conf (/etc/init.d/apache2/sites-avaliable/mysite.conf) 文件:
<VirtualHost *:80>
WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py

ServerName mysite.com.br
Alias /static /var/www/mysite/media/static/

<Directory /var/www/mysite/mysite>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

wsgi 文件(/var/www/mysite/mysite/wsgi.py):
import os
import sys

sys.path.insert(0, '/var/www/mysite')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Django mysite.settings (/var/www/mysite/mysite/settings.py):
...
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
...

Django mysite.urls (/var/www/mysite/mysite/urls.py):
from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)

就这样。我错过了什么吗?

谢谢!

最佳答案

这是 apache 配置错误。

我相信你应该指的是:-

<Directory /var/www/mysite>
Order allow,deny
Allow from all
</Directory>

关于在/admin/中找不到 Django 管理页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13637922/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com