1
Fork 0

init Django project

This commit is contained in:
Jake Howard 2020-04-12 14:41:27 +01:00
parent efc84afc4b
commit 2aedcd3183
Signed by: jake
GPG key ID: 57AFB45680EDD477
8 changed files with 140 additions and 0 deletions

21
manage.py Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

View file

@ -0,0 +1 @@
django==3.0.5

7
scripts/start.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
export PATH=env/bin:${PATH}
./manage.py runserver

17
scripts/test.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e
export PATH=env/bin:${PATH}
echo "> Running formatter..."
black website/ --check
echo "> Running linter..."
flake8 website/
echo "> Running isort..."
isort -rc -c website/
echo "> Running type checker..."
mypy website/

0
website/__init__.py Normal file
View file

75
website/settings.py Normal file
View file

@ -0,0 +1,75 @@
"""
Django settings for website project.
Generated by 'django-admin startproject' using Django 3.0.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "gd(%^4!762m4y*c56t(ppm&-5+*a*6-&5)n%nc^aqfi%54^u_j"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
"django.contrib.staticfiles",
]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "website.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",
],
},
},
]
WSGI_APPLICATION = "website.wsgi.application"
LANGUAGE_CODE = "en-gb"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = "/static/"

3
website/urls.py Normal file
View file

@ -0,0 +1,3 @@
from django.urls import path
urlpatterns = []

16
website/wsgi.py Normal file
View file

@ -0,0 +1,16 @@
"""
WSGI config for website project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")
application = get_wsgi_application()