· 8 years ago · Feb 05, 2018, 10:44 AM
1#!/usr/bin/env python
2import os
3import sys
4
5if __name__ == "__main__":
6os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geologyacademy.settings")
7try:
8 from django.core.management import execute_from_command_line
9except ImportError as exc:
10 raise ImportError(
11 "Couldn't import Django. Are you sure it's installed and "
12 "available on your PYTHONPATH environment variable? Did you "
13 "forget to activate a virtual environment?"
14 ) from exc
15execute_from_command_line(sys.argv)
16
17"""
18Django settings for project.
19
20Generated by 'django-admin startproject' using Django 2.0.
21
22For more information on this file, see
23https://docs.djangoproject.com/en/2.0/topics/settings/
24
25For the full list of settings and their values, see
26https://docs.djangoproject.com/en/2.0/ref/settings/
27"""
28
29import os
30
31# Build paths inside the project like this: os.path.join(BASE_DIR,
32...)
33BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
34
35
36# Quick-start development settings - unsuitable for production
37# See
38https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
39
40# SECURITY WARNING: keep the secret key used in production secret!
41SECRET_KEY = 'xxx'
42
43# SECURITY WARNING: don't run with debug turned on in production!
44DEBUG = False
45
46ALLOWED_HOSTS = ['xxx.xx.xxx.xx',
47'xxx.com']
48
49
50# Application definition
51
52INSTALLED_APPS = [
53'django.contrib.admin',
54'django.contrib.auth',
55'django.contrib.contenttypes',
56'django.contrib.sessions',
57'django.contrib.messages',
58'django.contrib.staticfiles',
59'...',
60
61]
62
63MIDDLEWARE = [
64'django.middleware.security.SecurityMiddleware',
65'django.contrib.sessions.middleware.SessionMiddleware',
66'django.middleware.common.CommonMiddleware',
67'django.middleware.csrf.CsrfViewMiddleware',
68'django.contrib.auth.middleware.AuthenticationMiddleware',
69'django.contrib.messages.middleware.MessageMiddleware',
70'django.middleware.clickjacking.XFrameOptionsMiddleware',
71]
72
73ROOT_URLCONF = 'xxx.urls'
74
75TEMPLATES = [
76{
77 'BACKEND': 'django.template.backends.django.DjangoTemplates',
78 'DIRS': [],
79 'APP_DIRS': True,
80 'OPTIONS': {
81 'context_processors': [
82 'django.template.context_processors.debug',
83 'django.template.context_processors.request',
84 'django.contrib.auth.context_processors.auth',
85 'django.contrib.messages.context_processors.messages',
86 ],
87 },
88},
89]
90
91WSGI_APPLICATION = 'xxx.wsgi.application'
92
93
94# Database
95# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
96
97DATABASES = {
98'default': {
99 'ENGINE': 'django.db.backends.sqlite3',
100 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
101}
102}
103
104
105# Password validation
106# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-
107validators
108
109AUTH_PASSWORD_VALIDATORS = [
110{
111 'NAME':
112'django.contrib.auth.password_validation.UserAttributeSimilarityValidator
113',
114},
115{
116 'NAME':
117'django.contrib.auth.password_validation.MinimumLengthValidator',
118},
119{
120 'NAME':
121'django.contrib.auth.password_validation.CommonPasswordValidator',
122},
123{
124 'NAME':
125'django.contrib.auth.password_validation.NumericPasswordValidator',
126},
127]
128
129
130# Internationalization
131# https://docs.djangoproject.com/en/2.0/topics/i18n/
132
133LANGUAGE_CODE = 'es-es'
134
135TIME_ZONE = 'UTC'
136
137USE_I18N = True
138
139USE_L10N = True
140
141USE_TZ = True
142
143
144# Static files (CSS, JavaScript, Images)
145# https://docs.djangoproject.com/en/2.0/howto/static-files/
146
147STATIC_URL = '/static/'
148
149STATICFILES_DIRS = [
150os.path.join(BASE_DIR, "static"),
151
152]
153
154
155
156STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static")