Skip to content

Commit 6a01c4e

Browse files
committed
Add example project
1 parent 856423b commit 6a01c4e

File tree

7 files changed

+205
-1
lines changed

7 files changed

+205
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,6 @@ ENV/
102102
.mypy_cache/
103103

104104
# IDE settings
105-
.vscode/
105+
.vscode/
106+
107+
example/db.sqlite3

example/example/__init__.py

Whitespace-only changes.

example/example/asgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for example project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
15+
16+
application = get_asgi_application()

example/example/settings.py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
"""
2+
Django settings for example project.
3+
4+
Generated by 'django-admin startproject' using Django 4.2.6.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.2/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/4.2/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
15+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16+
BASE_DIR = Path(__file__).resolve().parent.parent
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = "django-insecure-d&n+uf9918+%o$)1zczhiw4s_7@pqjot+4hf37)od25q82-%)z"
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
"django.contrib.admin",
35+
"django.contrib.auth",
36+
"django.contrib.contenttypes",
37+
"django.contrib.sessions",
38+
"django.contrib.messages",
39+
"django.contrib.staticfiles",
40+
"rest_framework",
41+
"rest_framework_gis",
42+
# "simple_history",
43+
"location_api"
44+
]
45+
46+
MIDDLEWARE = [
47+
"django.middleware.security.SecurityMiddleware",
48+
"django.contrib.sessions.middleware.SessionMiddleware",
49+
"django.middleware.common.CommonMiddleware",
50+
"django.middleware.csrf.CsrfViewMiddleware",
51+
"django.contrib.auth.middleware.AuthenticationMiddleware",
52+
"django.contrib.messages.middleware.MessageMiddleware",
53+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
54+
]
55+
56+
ROOT_URLCONF = "example.urls"
57+
58+
TEMPLATES = [
59+
{
60+
"BACKEND": "django.template.backends.django.DjangoTemplates",
61+
"DIRS": [],
62+
"APP_DIRS": True,
63+
"OPTIONS": {
64+
"context_processors": [
65+
"django.template.context_processors.debug",
66+
"django.template.context_processors.request",
67+
"django.contrib.auth.context_processors.auth",
68+
"django.contrib.messages.context_processors.messages",
69+
],
70+
},
71+
},
72+
]
73+
74+
WSGI_APPLICATION = "example.wsgi.application"
75+
76+
77+
# Database
78+
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
79+
80+
DATABASES = {
81+
"default": {
82+
"ENGINE": "django.db.backends.sqlite3",
83+
"NAME": BASE_DIR / "db.sqlite3",
84+
}
85+
}
86+
87+
88+
# Password validation
89+
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
90+
91+
AUTH_PASSWORD_VALIDATORS = [
92+
{
93+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
94+
},
95+
{
96+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
97+
},
98+
{
99+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
100+
},
101+
{
102+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
103+
},
104+
]
105+
106+
107+
# Internationalization
108+
# https://docs.djangoproject.com/en/4.2/topics/i18n/
109+
110+
LANGUAGE_CODE = "en-us"
111+
112+
TIME_ZONE = "UTC"
113+
114+
USE_I18N = True
115+
116+
USE_TZ = True
117+
118+
119+
# Static files (CSS, JavaScript, Images)
120+
# https://docs.djangoproject.com/en/4.2/howto/static-files/
121+
122+
STATIC_URL = "static/"
123+
124+
# Default primary key field type
125+
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
126+
127+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

example/example/urls.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
URL configuration for example project.
3+
4+
The `urlpatterns` list routes URLs to views. For more information please see:
5+
https://docs.djangoproject.com/en/4.2/topics/http/urls/
6+
Examples:
7+
Function views
8+
1. Add an import: from my_app import views
9+
2. Add a URL to urlpatterns: path('', views.home, name='home')
10+
Class-based views
11+
1. Add an import: from other_app.views import Home
12+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
13+
Including another URLconf
14+
1. Import the include() function: from django.urls import include, path
15+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16+
"""
17+
from django.urls import path, include
18+
19+
urlpatterns = [
20+
path("api/", include("location_api.urls")),
21+
]

example/example/wsgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for example project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
15+
16+
application = get_wsgi_application()

example/manage.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == "__main__":
22+
main()

0 commit comments

Comments
 (0)