Python 我无法在Ubuntu中使用apache和wsgi部署Django 1.7 admin

Python 我无法在Ubuntu中使用apache和wsgi部署Django 1.7 admin,python,django,apache,ubuntu,deployment,Python,Django,Apache,Ubuntu,Deployment,我正在用apache和wsgi在ubuntu上用Django创建一个项目,我可以很容易地看到主页,但我想看到页面管理员internet searches ecomerce/admin 我的工作对象是: Django 1.7-python 2.7-apache2-Ubuntu14 我的代码如下: /etc/apache2/sites available/ecomerce.conf Django站点: wsgi.py url.py 设置.py Try set ALLOWED_HOSTS=['your

我正在用apache和wsgi在ubuntu上用Django创建一个项目,我可以很容易地看到主页,但我想看到页面管理员internet searches ecomerce/admin

我的工作对象是:

Django 1.7-python 2.7-apache2-Ubuntu14

我的代码如下:

/etc/apache2/sites available/ecomerce.conf Django站点: wsgi.py url.py 设置.py
Try set ALLOWED_HOSTS=['your.site.url']尝试使用urlhttp://ecomerce/admin/,带有尾随斜杠。我在Chrome上遇到过类似的问题。谢谢你的评论,但不要回答我的问题。我尝试了两种选择,但都不起作用。事实上,它无法识别文件url.py的位置
<VirtualHost *:80>
    ServerName ecomerce
    ServerAdmin webmaster@localhost
    WSGIScriptAlias / /var/www/ecomerce/ecomerce/wsgi.py
    <Directory /usr/var/www/ecomerce>
    <Files wsgi.py>
        Order deny,allow
         Allow from all
    </Files>
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
127.0.0.1    ecomerce
           ecomerce
                   ecomerce
                              settings.py
                              urls.py
                              wsgi.py
                              __init__.py
                   manage.py
                   db.sqlite3
import os
import sys
path = '/var/www/ecomerce'
if path not in sys.path:
sys.path.append(path)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ecomerce.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'ecomerce.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'^admin/', include(admin.site.urls)),
)
"""
Django settings for ecomerce project.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '56@w10z_c&%kf3#am#1(t=!c(bsf+mq@2pa(n&i8gky43l4#7g'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'ecomerce.urls'

WSGI_APPLICATION = 'ecomerce.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_URL = '/static/'