· 8 years ago · Nov 28, 2017, 06:04 PM
1/usr/local/www/djphy
2
3djphyenv djphypro
4
5127.0.0.1 localhost djphy
6
7<VirtualHost *:80>
8
9 ServerName djphy
10
11 Alias /static /usr/local/www/djphy/djphypro/static
12
13 <Directory /usr/local//www/djphy/djphypro/static>
14
15 Require all granted
16
17 </Directory>
18
19 <Directory /usr/local/www/djphy/djphypro>
20
21 <Files wsgi.py>
22
23 Require all granted
24
25 </Files>
26
27 </Directory>
28
29 WSGIDaemonProcess djphy python-path=/usr/local/www/djphy python-home=/usr/local/www/djphy/djphyenv
30
31 WSGIProcessGroup djphy
32
33 WSGIScriptAlias / /usr/local/www/djphy/djphypro/djphypro/wsgi.py
34
35</VirtualHost>
36
37a2ensite djphy.conf
38
39systemctl restart apache2
40
41...
42import os
43BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
44SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
45DEBUG = True
46ALLOWED_HOSTS = []
47INSTALLED_APPS = [
48 'django.contrib.admin',
49 'django.contrib.auth',
50 'django.contrib.contenttypes',
51 'django.contrib.sessions',
52 'django.contrib.messages',
53 'django.contrib.staticfiles',
54]
55MIDDLEWARE = [
56 'django.middleware.security.SecurityMiddleware',
57 'django.contrib.sessions.middleware.SessionMiddleware',
58 'django.middleware.common.CommonMiddleware',
59 'django.middleware.csrf.CsrfViewMiddleware',
60 'django.contrib.auth.middleware.AuthenticationMiddleware',
61 'django.contrib.messages.middleware.MessageMiddleware',
62 'django.middleware.clickjacking.XFrameOptionsMiddleware',
63]
64ROOT_URLCONF = 'djphypro.urls'
65TEMPLATES = [
66 {
67 'BACKEND': 'django.template.backends.django.DjangoTemplates',
68 'DIRS': [],
69 'APP_DIRS': True,
70 'OPTIONS': {
71 'context_processors': [
72 'django.template.context_processors.debug',
73 'django.template.context_processors.request',
74 'django.contrib.auth.context_processors.auth',
75 'django.contrib.messages.context_processors.messages',
76 ],
77 },
78 },
79]
80WSGI_APPLICATION = 'djphypro.wsgi.application'
81DATABASES = {
82 'default': {
83 'ENGINE': 'django.db.backends.sqlite3',
84 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
85 }
86}
87AUTH_PASSWORD_VALIDATORS = [
88 {
89 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
90 },
91 {
92 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
93 },
94 {
95 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
96 },
97 {
98 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
99 },
100]
101LANGUAGE_CODE = 'en-us'
102TIME_ZONE = 'UTC'
103USE_I18N = True
104USE_L10N = True
105USE_TZ = True
106STATIC_URL = '/static/'
107STATIC_ROOT = os.path.join(BASE_DIR, "static/")