|
1 | 1 | """ |
2 | | -Django settings for slackapp project. |
| 2 | +Django settings for myslackapp project. |
3 | 3 |
|
4 | | -Generated by 'django-admin startproject' using Django 3.0.8. |
| 4 | +Generated by 'django-admin startproject' using Django 3.2.3. |
5 | 5 |
|
6 | 6 | For more information on this file, see |
7 | | -https://docs.djangoproject.com/en/3.0/topics/settings/ |
| 7 | +https://docs.djangoproject.com/en/3.2/topics/settings/ |
8 | 8 |
|
9 | 9 | For the full list of settings and their values, see |
10 | | -https://docs.djangoproject.com/en/3.0/ref/settings/ |
| 10 | +https://docs.djangoproject.com/en/3.2/ref/settings/ |
11 | 11 | """ |
12 | | - |
13 | 12 | import os |
| 13 | +from pathlib import Path |
14 | 14 |
|
15 | | -LOGGING = { |
16 | | - "version": 1, |
17 | | - "disable_existing_loggers": False, |
18 | | - "handlers": { |
19 | | - "console": { |
20 | | - "class": "logging.StreamHandler", |
21 | | - }, |
22 | | - }, |
23 | | - "root": { |
24 | | - "handlers": ["console"], |
25 | | - "level": "DEBUG", |
26 | | - }, |
27 | | - "loggers": { |
28 | | - "django": { |
29 | | - "handlers": ["console"], |
30 | | - "level": os.getenv("DJANGO_LOG_LEVEL", "INFO"), |
31 | | - "propagate": False, |
32 | | - }, |
33 | | - "django.db": { |
34 | | - "level": "DEBUG", |
35 | | - }, |
36 | | - "slack_bolt": { |
37 | | - "handlers": ["console"], |
38 | | - "level": "DEBUG", |
39 | | - "propagate": False, |
40 | | - }, |
41 | | - }, |
42 | | -} |
| 15 | +# Build paths inside the project like this: BASE_DIR / 'subdir'. |
| 16 | +BASE_DIR = Path(__file__).resolve().parent.parent |
43 | 17 |
|
44 | | -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
45 | | -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
46 | 18 |
|
47 | 19 | # Quick-start development settings - unsuitable for production |
48 | | -# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ |
| 20 | +# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ |
49 | 21 |
|
50 | | -# SECURITY WARNING: keep the secret key used in production secret! |
51 | 22 | # TODO: CHANGE THIS IF YOU REUSE THIS APP |
52 | | -SECRET_KEY = ( |
53 | | - "This is just a example. You should not expose your secret key in real apps" |
54 | | -) |
| 23 | +SECRET_KEY = "This is just a example. You should not expose your secret key in real apps" |
55 | 24 |
|
56 | 25 | # SECURITY WARNING: don't run with debug turned on in production! |
57 | 26 | DEBUG = True |
58 | 27 |
|
| 28 | + |
59 | 29 | # ALLOWED_HOSTS = [] |
60 | 30 | ALLOWED_HOSTS = ["*"] |
61 | 31 |
|
| 32 | + |
62 | 33 | # Application definition |
63 | 34 |
|
64 | 35 | INSTALLED_APPS = [ |
|
68 | 39 | "django.contrib.sessions", |
69 | 40 | "django.contrib.messages", |
70 | 41 | "django.contrib.staticfiles", |
71 | | - "slackapp.apps.SlackAppConfig", |
| 42 | + "simple_app.apps.SimpleAppConfig", |
| 43 | + "oauth_app.apps.OauthAppConfig", |
72 | 44 | ] |
73 | 45 |
|
74 | 46 | MIDDLEWARE = [ |
|
81 | 53 | "django.middleware.clickjacking.XFrameOptionsMiddleware", |
82 | 54 | ] |
83 | 55 |
|
84 | | -ROOT_URLCONF = "slackapp.urls" |
| 56 | +ROOT_URLCONF = "myslackapp.urls" |
85 | 57 |
|
86 | 58 | TEMPLATES = [ |
87 | 59 | { |
|
99 | 71 | }, |
100 | 72 | ] |
101 | 73 |
|
102 | | -WSGI_APPLICATION = "slackapp.wsgi.application" |
| 74 | +WSGI_APPLICATION = "myslackapp.wsgi.application" |
| 75 | + |
103 | 76 |
|
104 | 77 | # Database |
105 | | -# https://docs.djangoproject.com/en/3.0/ref/settings/#databases |
| 78 | +# https://docs.djangoproject.com/en/3.2/ref/settings/#databases |
106 | 79 |
|
107 | 80 | DATABASES = { |
108 | | - # python manage.py migrate |
109 | | - # python manage.py runserver 0.0.0.0:3000 |
| 81 | + # You can initialize your local database by the following steps: |
| 82 | + # |
| 83 | + # python manage.py migrate |
| 84 | + # python manage.py runserver 0.0.0.0:3000 |
| 85 | + # |
| 86 | + "default": { |
| 87 | + "ENGINE": "django.db.backends.sqlite3", |
| 88 | + "NAME": BASE_DIR / "db.sqlite3", |
| 89 | + } |
| 90 | + # If you want to use MySQL quickly, the following steps work for you |
| 91 | + # |
| 92 | + # docker-compose -f mysql-docker-compose.yml up --build |
| 93 | + # pip install mysqlclient |
| 94 | + # python manage.py migrate |
| 95 | + # python manage.py runserver 0.0.0.0:3000 |
| 96 | + # |
| 97 | + # And then, enable the following setting instead: |
| 98 | + # |
110 | 99 | # "default": { |
111 | | - # "ENGINE": "django.db.backends.sqlite3", |
112 | | - # "NAME": os.path.join(BASE_DIR, "db.sqlite3"), |
| 100 | + # "ENGINE": "django.db.backends.mysql", |
| 101 | + # "NAME": "slackapp", |
| 102 | + # "USER": "app", |
| 103 | + # "PASSWORD": "password", |
| 104 | + # "HOST": "127.0.0.1", |
| 105 | + # "PORT": 33306, |
113 | 106 | # }, |
114 | | - |
115 | | - # docker-compose -f mysql-docker-compose.yml up --build |
116 | | - # pip install mysqlclient |
117 | | - # python manage.py migrate |
118 | | - # python manage.py runserver 0.0.0.0:3000 |
119 | | - "default": { |
120 | | - "ENGINE": "django.db.backends.mysql", |
121 | | - "NAME": "slackapp", |
122 | | - "USER": "app", |
123 | | - "PASSWORD": "password", |
124 | | - "HOST": "127.0.0.1", |
125 | | - "PORT": 33306, |
126 | | - }, |
127 | 107 | } |
128 | 108 |
|
| 109 | + |
129 | 110 | # Password validation |
130 | | -# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators |
| 111 | +# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators |
131 | 112 |
|
132 | 113 | AUTH_PASSWORD_VALIDATORS = [ |
133 | 114 | { |
|
144 | 125 | }, |
145 | 126 | ] |
146 | 127 |
|
| 128 | + |
147 | 129 | # Internationalization |
148 | | -# https://docs.djangoproject.com/en/3.0/topics/i18n/ |
| 130 | +# https://docs.djangoproject.com/en/3.2/topics/i18n/ |
149 | 131 |
|
150 | 132 | LANGUAGE_CODE = "en-us" |
151 | 133 |
|
|
157 | 139 |
|
158 | 140 | USE_TZ = True |
159 | 141 |
|
| 142 | + |
160 | 143 | # Static files (CSS, JavaScript, Images) |
161 | | -# https://docs.djangoproject.com/en/3.0/howto/static-files/ |
| 144 | +# https://docs.djangoproject.com/en/3.2/howto/static-files/ |
162 | 145 |
|
163 | 146 | STATIC_URL = "/static/" |
| 147 | + |
| 148 | +# Default primary key field type |
| 149 | +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field |
| 150 | + |
| 151 | +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" |
| 152 | + |
| 153 | + |
| 154 | +LOGGING = { |
| 155 | + "version": 1, |
| 156 | + "disable_existing_loggers": False, |
| 157 | + "handlers": { |
| 158 | + "console": { |
| 159 | + "class": "logging.StreamHandler", |
| 160 | + }, |
| 161 | + }, |
| 162 | + "root": { |
| 163 | + "handlers": ["console"], |
| 164 | + "level": "DEBUG", |
| 165 | + }, |
| 166 | + "loggers": { |
| 167 | + "django": { |
| 168 | + "handlers": ["console"], |
| 169 | + "level": os.getenv("DJANGO_LOG_LEVEL", "INFO"), |
| 170 | + "propagate": False, |
| 171 | + }, |
| 172 | + "django.db": { |
| 173 | + "level": "DEBUG", |
| 174 | + }, |
| 175 | + "slack_bolt": { |
| 176 | + "handlers": ["console"], |
| 177 | + "level": "DEBUG", |
| 178 | + "propagate": False, |
| 179 | + }, |
| 180 | + }, |
| 181 | +} |
0 commit comments