2017-06-11 6 views
0

Djangoを学び、シンプルなWebアプリケーションを作成できました。私はDebian 7.0でVPSにDjango Appを導入しようとしています。私はPython 2.7、Apache 2、libapache2-mod-wsgi、Django 1.11.2を使用しています。ドメインサーバーにアクセスし、「It's works」ページのみが表示されるまで、すべてうまくいった。Django Apacheのみ表示作品ページ

これは、000-は、default.confファイルです。ここで

<VirtualHost *:80> 
ServerName serverededenid-to.cloud.revoluz.io 
ServerAdmin [email protected] 

Alias /static /var/www/static-root 
<Directory /var/www/static-root> 
    Require all granted 
</Directory> 

Alias /media /var/www/media-root 
<Directory /var/www/media-root> 
    Require all granted 
</Directory> 

<Directory /var/www/venv/src/cfehome> 
    <Files wsgi.py> 
     Require all granted 
    </Files> 
</Directory> 

WSGIDaemonProcess cfehome python-path=/var/www/venv/src/:/var/www/venv/lib/python2.7/site-packages 
WSGIProcessGroup cfehome 
WSGIScriptAlias//var/www/venv/src/cfehome/wsgi.py 


ErrorLog ${APACHE_LOG_DIR}/error.log 
CustomLog ${APACHE_LOG_DIR}/access.log combined 

</VirtualHost> 

は私urls.pyです:ここでは

from django.conf.urls import url 
from django.contrib import admin 

urlpatterns = [ 
    url(r'^admin/', admin.site.urls), 
] 

は私のsettings.pyです:

import os 

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


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

# SECURITY WARNING: keep the secret key used in production secret! 
SECRET_KEY = '9uy#-g_rmn^)&[email protected]*37srhw7h0fiyv*2*[email protected]+gzg' 

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

ALLOWED_HOSTS = ['serverededenid-to.cloud.revoluz.io', '10.10.26.236'] 


# Application definition 

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

MIDDLEWARE = [ 
    'django.middleware.security.SecurityMiddleware', 
    'django.contrib.sessions.middleware.SessionMiddleware', 
    'django.middleware.common.CommonMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
] 

ROOT_URLCONF = 'cfehome.urls' 

TEMPLATES = [ 
    { 
     'BACKEND': 'django.template.backends.django.DjangoTemplates', 
     'DIRS': [], 
     'APP_DIRS': True, 
     'OPTIONS': { 
      'context_processors': [ 
       'django.template.context_processors.debug', 
       'django.template.context_processors.request', 
       'django.contrib.auth.context_processors.auth', 
       'django.contrib.messages.context_processors.messages', 
      ], 
     }, 
    }, 
] 

WSGI_APPLICATION = 'cfehome.wsgi.application' 


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

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


# Password validation 
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 

AUTH_PASSWORD_VALIDATORS = [ 
    { 
     'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 
    }, 
    { 
     'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 
    }, 
    { 
     'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 
    }, 
    { 
     'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 
    }, 
] 


# Internationalization 
# https://docs.djangoproject.com/en/1.11/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.11/howto/static-files/ 

STATIC_URL = '/static/' 
STATIC_ROOT = '/var/www/static-root/' 
MEDIA_ROOT = '/var/www/media-root/' 

どれ体私を助けることができますか?

+0

トップレベルのurls.pyはどのように見えますか? django adminの場合は – mikep

+0

です。 –

+0

管理ページは機能しますか? – mikep

答えて

0

あなたのurls.pyを空にし、これらを追加してみてください:

url(r'^admin/', include(admin.site.urls)), 
url(r'^$', views.index, name='index'), 

ところ 'インデックス' は、あなたのインデックス図です。

関連する問題