Skip to content

Commit 89a86d7

Browse files
Initial commit
0 parents  commit 89a86d7

27 files changed

+501
-0
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.pyc
2+
*.DS_Store
3+
*.egg*
4+
/dist/
5+
/.idea
6+
/docs/_build/
7+
/node_modules/
8+
build/
9+
env
10+
11+
#src
12+
*.sqlite*
13+

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Change Log
2+
3+
## [1.0.5] 2024-01-20
4+
### Changes
5+
6+
- Added DOCS (readme)
7+
- `Video`: [Django for Beginners - Simple Codebase Intro](https://www.youtube.com/watch?v=dVybpJRwbmc)
8+
- `Video`: [Django for Beginners - Go LIVE with Render](https://www.youtube.com/watch?v=JyzjVYMuzBQ)
9+
- `Video`: [Django for Beginners - Integrate UI (Volt Dashboard)](https://www.youtube.com/watch?v=gqw0Bs67lM4)
10+
11+
## [1.0.4] 2024-01-20
12+
### Changes
13+
14+
- Added `WhiteNoiseMiddleware` for static files
15+
- Update `Dockerfile` - added all steps
16+
17+
## [1.0.3] 2024-01-19
18+
### Changes
19+
20+
- Update Docker File
21+
- added `EXPOSE 5005` directive
22+
- Update DOCS (readme)
23+
24+
## [1.0.2] 2024-01-19
25+
### Changes
26+
27+
- Added `static` and `templates` DIRs
28+
- Added HOME app
29+
- Render deployment files
30+
- Update DEPS
31+
32+
## [1.0.1] 2024-01-08
33+
### Changes
34+
35+
- Pin versions in REQ.txt
36+
37+
## [1.0.0] 2022-10-20
38+
### Changes
39+
40+
- Code the basic structure
41+

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.9
2+
3+
# set environment variables
4+
ENV PYTHONDONTWRITEBYTECODE 1
5+
ENV PYTHONUNBUFFERED 1
6+
7+
COPY requirements.txt .
8+
# install python dependencies
9+
RUN pip install --upgrade pip
10+
RUN pip install --no-cache-dir -r requirements.txt
11+
12+
COPY . .
13+
14+
# Static Files
15+
RUN python manage.py collectstatic --no-input
16+
17+
# running migrations
18+
RUN python manage.py makemigrations
19+
RUN python manage.py migrate
20+
21+
# Gunicorn
22+
EXPOSE 5005
23+
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# [Django Core](https://github.com/app-generator/core-django)
2+
3+
Minimal **Django** project with `Docker` support - actively supported by [App Generator](https://app-generator.dev/) via `Email` and **[Discord](https://discord.gg/fZC6hup)**.
4+
5+
---
6+
7+
> For a **complete set of features** and long-term support, check out **[Dynamic Django](https://app-generator.dev/docs/developer-tools/dynamic-django/index.html)**, a powerful starter that incorporates:
8+
9+
-[Dynamic DataTables](https://app-generator.dev/docs/developer-tools/dynamic-django/datatables.html): using a single line of configuration, the data saved in any table is automatically managed
10+
-[Dynamic API](https://app-generator.dev/docs/developer-tools/dynamic-django/api.html): any model can become a secure API Endpoint using DRF
11+
-[Dynamic Charts](https://app-generator.dev/docs/developer-tools/dynamic-django/charts.html): extract relevant charts without coding all major types are supported
12+
-[CSV Loader](https://app-generator.dev/docs/developer-tools/dynamic-django/csv-loader.html): translate CSV files into Django Models and (optional) load the information
13+
- ✅ Powerful [CLI Tools](https://app-generator.dev/docs/developer-tools/dynamic-django/cli.html) for the GIT interface, configuration editing, updating the configuration and database (create models, migrate DB)
14+
15+
<br />
16+
17+
## Start in `Docker`
18+
19+
> 👉 **Step 1** - Download the code from the GH repository (using `GIT`)
20+
21+
```bash
22+
$ git clone https://github.com/app-generator/core-django.git
23+
$ cd core-django
24+
```
25+
26+
<br />
27+
28+
> 👉 **Step 2** - Start the APP in `Docker`
29+
30+
```bash
31+
$ docker-compose up --build
32+
```
33+
34+
Visit `http://localhost:5085` in your browser. The app should be up & running.
35+
36+
<br />
37+
38+
## Manual Build
39+
40+
> 👉 Download the code
41+
42+
```bash
43+
$ git clone https://github.com/app-generator/core-django.git
44+
$ cd core-django
45+
```
46+
47+
<br />
48+
49+
> 👉 Install modules via `VENV`
50+
51+
```bash
52+
$ virtualenv env
53+
$ source env/bin/activate
54+
$ pip install -r requirements.txt
55+
```
56+
57+
<br />
58+
59+
> 👉 Set Up Database
60+
61+
```bash
62+
$ python manage.py makemigrations
63+
$ python manage.py migrate
64+
```
65+
66+
<br />
67+
68+
> 👉 Start the app
69+
70+
```bash
71+
$ python manage.py runserver
72+
```
73+
74+
At this point, the app runs at `http://127.0.0.1:8000/`.
75+
76+
<br />
77+
78+
---
79+
**[Django Core](https://github.com/app-generator/core-django)** - Minimal **Django** core provided by **[AppSeed](https://appseed.us/)**

build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# exit on error
3+
set -o errexit
4+
5+
# Install modules
6+
python -m pip install --upgrade pip
7+
pip install -r requirements.txt
8+
9+
# Collect Static
10+
python manage.py collectstatic --no-input
11+
12+
# Migrate DB
13+
python manage.py makemigrations
14+
python manage.py migrate

core/__init__.py

Whitespace-only changes.

core/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 core 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.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", "core.settings")
15+
16+
application = get_asgi_application()

core/settings.py

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

core/urls.py

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

core/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 core 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.1/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", "core.settings")
15+
16+
application = get_wsgi_application()

0 commit comments

Comments
 (0)