Posted under » MySQL » Django on 23 April 2021
From Installing mod_wsgi for django we know we have to
ALLOWED_HOSTS = ['student.com'] WSGI_APPLICATION = 'student_als.wsgi.application'
Now we have to
TIME_ZONE = 'Asia/Singapore'
Switch from SQlite to mysql with this
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'dbblog', 'USER': 'tidak', 'PASSWORD': 't35nang12', 'HOST': 'localhost', 'PORT': '3306', } }
You can add another database too perhaps a read only one.
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'student', 'USER': 'anoneh', 'PASSWORD': 'MrsLKY1', 'HOST': 'localhost', 'PORT': '3306', } }, 'eauthor': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'LMS_contents', 'USER': 'anoneh', 'PASSWORD': 'MrsLKY1', 'HOST': 'localhost', 'PORT': '3306', 'OPTIONS': { 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" } } }
For any new app created. Take note the case for the Config, it is
'polls.apps.PollsConfig' and not 'polls.apps.pollsConfig'.
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'polls.apps.PollsConfig', 'napi.apps.NapiConfig', ]
You can make URL alias like
LOGIN_URL = 'login' LOGIN_REDIRECT_URL = 'innerpage'
You have to give email settings for your user change password to work.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.office365.com' EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = 'bill@gates.edu.sg' EMAIL_HOST_PASSWORD = 'MrLK1sUgly' DEFAULT_FROM_EMAIL = 'Mr. Softee <whgates@gates.edu.sg>'
This is quite similar to phpmailer settings.
Static files
STATIC_URL = '/static/' STATIC_ROOT = "/var/www/dblog/static/"
More on Static files.