Skip to content

Commit dcd84d2

Browse files
author
Aria
committed
initial commit - scaffold django app
0 parents  commit dcd84d2

22 files changed

+575
-0
lines changed

.gitignore

+208
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
.direnv
2+
.envrc
3+
hackmap/local_settings.py
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
pnpm-debug.log*
11+
lerna-debug.log*
12+
13+
node_modules
14+
dist
15+
dist-ssr
16+
*.local
17+
18+
# Editor directories and files
19+
.vscode/*
20+
!.vscode/extensions.json
21+
.idea
22+
.DS_Store
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?
28+
29+
db.sqlite3
30+
collectedstatic
31+
# Created by https://www.toptal.com/developers/gitignore/api/python
32+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
33+
34+
### Python ###
35+
# Byte-compiled / optimized / DLL files
36+
__pycache__/
37+
*.py[cod]
38+
*$py.class
39+
40+
# C extensions
41+
*.so
42+
43+
# Distribution / packaging
44+
.Python
45+
build/
46+
develop-eggs/
47+
dist/
48+
downloads/
49+
eggs/
50+
.eggs/
51+
lib/
52+
lib64/
53+
parts/
54+
sdist/
55+
var/
56+
wheels/
57+
share/python-wheels/
58+
*.egg-info/
59+
.installed.cfg
60+
*.egg
61+
MANIFEST
62+
63+
# PyInstaller
64+
# Usually these files are written by a python script from a template
65+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
66+
*.manifest
67+
*.spec
68+
69+
# Installer logs
70+
pip-log.txt
71+
pip-delete-this-directory.txt
72+
73+
# Unit test / coverage reports
74+
htmlcov/
75+
.tox/
76+
.nox/
77+
.coverage
78+
.coverage.*
79+
.cache
80+
nosetests.xml
81+
coverage.xml
82+
*.cover
83+
*.py,cover
84+
.hypothesis/
85+
.pytest_cache/
86+
cover/
87+
88+
# Translations
89+
*.mo
90+
*.pot
91+
92+
# Django stuff:
93+
*.log
94+
local_settings.py
95+
db.sqlite3
96+
db.sqlite3-journal
97+
98+
# Flask stuff:
99+
instance/
100+
.webassets-cache
101+
102+
# Scrapy stuff:
103+
.scrapy
104+
105+
# Sphinx documentation
106+
docs/_build/
107+
108+
# PyBuilder
109+
.pybuilder/
110+
target/
111+
112+
# Jupyter Notebook
113+
.ipynb_checkpoints
114+
115+
# IPython
116+
profile_default/
117+
ipython_config.py
118+
119+
# pyenv
120+
# For a library or package, you might want to ignore these files since the code is
121+
# intended to run in multiple environments; otherwise, check them in:
122+
# .python-version
123+
124+
# pipenv
125+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
126+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
127+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
128+
# install all needed dependencies.
129+
#Pipfile.lock
130+
131+
# poetry
132+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
133+
# This is especially recommended for binary packages to ensure reproducibility, and is more
134+
# commonly ignored for libraries.
135+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
136+
#poetry.lock
137+
138+
# pdm
139+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
140+
#pdm.lock
141+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
142+
# in version control.
143+
# https://pdm.fming.dev/#use-with-ide
144+
.pdm.toml
145+
146+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
147+
__pypackages__/
148+
149+
# Celery stuff
150+
celerybeat-schedule
151+
celerybeat.pid
152+
153+
# SageMath parsed files
154+
*.sage.py
155+
156+
# Environments
157+
.env
158+
.venv
159+
env/
160+
venv/
161+
ENV/
162+
env.bak/
163+
venv.bak/
164+
165+
# Spyder project settings
166+
.spyderproject
167+
.spyproject
168+
169+
# Rope project settings
170+
.ropeproject
171+
172+
# mkdocs documentation
173+
/site
174+
175+
# mypy
176+
.mypy_cache/
177+
.dmypy.json
178+
dmypy.json
179+
180+
# Pyre type checker
181+
.pyre/
182+
183+
# pytype static type analyzer
184+
.pytype/
185+
186+
# Cython debug symbols
187+
cython_debug/
188+
189+
# PyCharm
190+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
191+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
192+
# and can be added to the global gitignore or merged into this file. For a more nuclear
193+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
194+
#.idea/
195+
196+
### Python Patch ###
197+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
198+
poetry.toml
199+
200+
# ruff
201+
.ruff_cache/
202+
203+
# LSP config files
204+
pyrightconfig.json
205+
206+
# End of https://www.toptal.com/developers/gitignore/api/python
207+
208+
src/dist

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# hackmap
2+
3+
a django app, with vite for typescript packaging.
4+
5+
## development
6+
7+
either use nix-shell, or download:
8+
9+
- pyenv / python 3.11+
10+
- poetry
11+
12+
and run `poetry env use` then `poetry run manage.py runserver` to start the django app.
13+
14+
formatting should be checked with `ruff`, and types with `pyright`.

hackmap/__init__.py

Whitespace-only changes.

hackmap/asgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for hackmap 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/5.1/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", "hackmap.settings")
15+
16+
application = get_asgi_application()

hackmap/local_settings.py.tmpl

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from pathlib import Path
2+
3+
BASE_DIR = Path(__file__).resolve().parent.parent
4+
5+
# Quick-start development settings - unsuitable for production
6+
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
7+
8+
# python3 -c 'import secrets; print(secrets.token_hex(100))'
9+
SECRET_KEY = "django-insecure-^00bdam@mzm3df^xwd%#pkmq70ksnj(rb81t6rup6zwibd_(3d"
10+
DEBUG = True
11+
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
12+
13+
# Database
14+
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
15+
16+
DATABASES = {
17+
"default": {
18+
"ENGINE": "django.db.backends.sqlite3",
19+
"NAME": BASE_DIR / "db.sqlite3",
20+
}
21+
}

hackmap/settings.py

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
"""
2+
For more information on this file, see
3+
https://docs.djangoproject.com/en/5.1/topics/settings/
4+
5+
For the full list of settings and their values, see
6+
https://docs.djangoproject.com/en/5.1/ref/settings/
7+
"""
8+
9+
from pathlib import Path
10+
11+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
12+
BASE_DIR = Path(__file__).resolve().parent.parent
13+
14+
15+
# Application definition
16+
17+
INSTALLED_APPS = [
18+
"django.contrib.admin",
19+
"django.contrib.auth",
20+
"django.contrib.contenttypes",
21+
"django.contrib.sessions",
22+
"django.contrib.messages",
23+
"django.contrib.staticfiles",
24+
]
25+
26+
MIDDLEWARE = [
27+
"django.middleware.security.SecurityMiddleware",
28+
"django.contrib.sessions.middleware.SessionMiddleware",
29+
"django.middleware.common.CommonMiddleware",
30+
"django.middleware.csrf.CsrfViewMiddleware",
31+
"django.contrib.auth.middleware.AuthenticationMiddleware",
32+
"django.contrib.messages.middleware.MessageMiddleware",
33+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
34+
]
35+
36+
ROOT_URLCONF = "hackmap.urls"
37+
38+
TEMPLATES = [
39+
{
40+
"BACKEND": "django.template.backends.django.DjangoTemplates",
41+
"DIRS": [BASE_DIR / "templates"],
42+
"APP_DIRS": True,
43+
"OPTIONS": {
44+
"context_processors": [
45+
"django.template.context_processors.debug",
46+
"django.template.context_processors.request",
47+
"django.contrib.auth.context_processors.auth",
48+
"django.contrib.messages.context_processors.messages",
49+
],
50+
},
51+
},
52+
]
53+
54+
WSGI_APPLICATION = "hackmap.wsgi.application"
55+
56+
57+
# Password validation
58+
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
59+
60+
AUTH_PASSWORD_VALIDATORS = [
61+
{
62+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
63+
},
64+
{
65+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
66+
},
67+
{
68+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
69+
},
70+
{
71+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
72+
},
73+
]
74+
75+
76+
# Internationalization
77+
# https://docs.djangoproject.com/en/5.1/topics/i18n/
78+
79+
LANGUAGE_CODE = "en-us"
80+
81+
TIME_ZONE = "UTC"
82+
83+
USE_I18N = True
84+
85+
USE_TZ = True
86+
87+
# Static files (CSS, JavaScript, Images)
88+
# https://docs.djangoproject.com/en/5.1/howto/static-files/
89+
90+
STATIC_URL = "static/"
91+
STATIC_ROOT = BASE_DIR / "collectedstatic"
92+
STATICFILES_DIRS = [BASE_DIR / "static"]
93+
94+
# Default primary key field type
95+
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
96+
97+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
98+
99+
from .local_settings import *

hackmap/urls.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
URL configuration for hackmap project.
3+
4+
The `urlpatterns` list routes URLs to views. For more information please see:
5+
https://docs.djangoproject.com/en/5.1/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+
18+
from django.contrib import admin
19+
from django.urls import path
20+
from labmap import views
21+
22+
urlpatterns = [path("admin/", admin.site.urls), path("", views.hello)]

0 commit comments

Comments
 (0)