Skip to content

Commit 93f424a

Browse files
committed
Codebase UPD - Theme-able, CI/CD flow
1 parent 853e837 commit 93f424a

26 files changed

+511
-0
lines changed

.gitignore

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

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
# running migrations
15+
RUN python manage.py migrate
16+
17+
# gunicorn
18+
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# [Django Material Kit](https://appseed.us/product/material-kit/django/)
2+
3+
Open-source **Django** project crafted on top of **[Material Kit](https://appseed.us/product/material-kit/django/)**, an open-source design from `Creative-Tim`.
4+
The product is designed to deliver the best possible user experience with highly customizable feature-rich pages.
5+
6+
- 👉 [Django Material Kit](https://appseed.us/product/material-kit/django/) - `Product page`
7+
- 👉 [Django Material Kit](https://django-material-kit.appseed-srv1.com/) - `LIVE Demo`
8+
- 🛒 **[Django Material Kit PRO](https://appseed.us/product/pixel-bootstrap-pro/django/)** - `Premium Version`
9+
10+
<br />
11+
12+
> Features:
13+
14+
-`Up-to-date Dependencies`
15+
- ✅ Theme: [Django Theme Material Kit](https://github.com/app-generator/django-theme-material-kit)
16+
-**Authentication**: `Django.contrib.AUTH`, Registration
17+
- 🚀 `Deployment`
18+
- `CI/CD` flow via `Render`
19+
20+
<br />
21+
22+
![Material Kit - Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/167396765-c88b7a95-155f-4236-8691-7b80fa2d9cd9.png)
23+
24+
<br />
25+
26+
## Manual Build
27+
28+
> 👉 Download the code
29+
30+
```bash
31+
$ git clone https://github.com/app-generator/django-material-kit.git
32+
$ cd django-material-kit
33+
```
34+
35+
<br />
36+
37+
> 👉 Install modules via `VENV`
38+
39+
```bash
40+
$ virtualenv env
41+
$ source env/bin/activate
42+
$ pip install -r requirements.txt
43+
```
44+
45+
<br />
46+
47+
> 👉 Set Up Database
48+
49+
```bash
50+
$ python manage.py makemigrations
51+
$ python manage.py migrate
52+
```
53+
54+
<br />
55+
56+
> 👉 Create the Superuser
57+
58+
```bash
59+
$ python manage.py createsuperuser
60+
```
61+
62+
<br />
63+
64+
> 👉 Start the app
65+
66+
```bash
67+
$ python manage.py runserver
68+
```
69+
70+
At this point, the app runs at `http://127.0.0.1:8000/`.
71+
72+
<br />
73+
74+
## [PRO Version](https://appseed.us/product/material-kit2-pro/django/)
75+
76+
**Material Kit 2** is a premium design crafted by the `Creative-Tim` agency on top of Bootstrap 5 Framework. Designed for those who like bold elements and beautiful websites, Material Kit 2 is made of hundreds of elements, designed blocks, and fully coded pages built with an impressive level of quality.
77+
78+
- 👉 [Django Material Kit2 PRO](https://appseed.us/product/material-kit2-pro/django/) - product page
79+
-`Enhanced UI` - more pages and components
80+
-`Priority` on support
81+
82+
<br />
83+
84+
![Mk2 PRO - Premium Seed project by AppSeed.](https://user-images.githubusercontent.com/51070104/168224733-b054bb46-d454-4aea-bb94-2d01bf4760d2.png)
85+
86+
<br />
87+
88+
---
89+
[Django Material Kit](https://appseed.us/product/material-kit/django/) - **Django** Starter provided by **[AppSeed](https://appseed.us/)**

README_deploy.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# How to deploy on `Render`
2+
3+
> This document should contains all the steps to deploy the app on render without much effort, using PostgreSQL
4+
5+
https://render.com/docs/deploy-django
6+
7+
## ALL STEPS below
8+
9+
<br />
10+
11+
### 👉 Create `PostgreSQL` database on render
12+
- Go to https://dashboard.render.com/new/database this link.
13+
- Database name should be `berry`.
14+
- Keep the Database, User and Datadog API Key as it is.
15+
- If you want to change database name anything else then you have to change your `render.yaml` file database name too.
16+
17+
<br />
18+
19+
### 👉 Create a Blueprint instance
20+
- Go to https://dashboard.render.com/blueprints this link.
21+
- Click `New Blueprint Instance` button.
22+
- Connect your `repo` which you want to deploy.
23+
- Fill the `Service Group Name` and click on `Update Existing Resources` button.
24+
- After that your deployment will start automatically.

build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
# exit on error
3+
set -o errexit
4+
5+
python -m pip install --upgrade pip
6+
7+
pip install -r requirements.txt
8+
9+
python manage.py collectstatic --no-input
10+
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: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
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+
from dotenv import load_dotenv
16+
17+
load_dotenv() # take environment variables from .env.
18+
19+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
20+
BASE_DIR = Path(__file__).resolve().parent.parent
21+
22+
# Quick-start development settings - unsuitable for production
23+
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
24+
25+
# SECURITY WARNING: keep the secret key used in production secret!
26+
SECRET_KEY = os.environ.get('SECRET_KEY')
27+
if not SECRET_KEY:
28+
SECRET_KEY = ''.join(random.choice( string.ascii_lowercase ) for i in range( 32 ))
29+
30+
# Render Deployment Code
31+
DEBUG = 'RENDER' not in os.environ
32+
33+
ALLOWED_HOSTS = []
34+
35+
RENDER_EXTERNAL_HOSTNAME = os.environ.get('RENDER_EXTERNAL_HOSTNAME')
36+
if RENDER_EXTERNAL_HOSTNAME:
37+
ALLOWED_HOSTS.append(RENDER_EXTERNAL_HOSTNAME)
38+
39+
# Application definition
40+
41+
INSTALLED_APPS = [
42+
"django.contrib.admin",
43+
"django.contrib.auth",
44+
"django.contrib.contenttypes",
45+
"django.contrib.sessions",
46+
"django.contrib.messages",
47+
"django.contrib.staticfiles",
48+
49+
'theme_material_kit',
50+
"home",
51+
]
52+
53+
MIDDLEWARE = [
54+
"django.middleware.security.SecurityMiddleware",
55+
"whitenoise.middleware.WhiteNoiseMiddleware",
56+
"django.contrib.sessions.middleware.SessionMiddleware",
57+
"django.middleware.common.CommonMiddleware",
58+
"django.middleware.csrf.CsrfViewMiddleware",
59+
"django.contrib.auth.middleware.AuthenticationMiddleware",
60+
"django.contrib.messages.middleware.MessageMiddleware",
61+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
62+
]
63+
64+
ROOT_URLCONF = "core.urls"
65+
66+
TEMPLATES = [
67+
{
68+
"BACKEND": "django.template.backends.django.DjangoTemplates",
69+
"DIRS": [],
70+
"APP_DIRS": True,
71+
"OPTIONS": {
72+
"context_processors": [
73+
"django.template.context_processors.debug",
74+
"django.template.context_processors.request",
75+
"django.contrib.auth.context_processors.auth",
76+
"django.contrib.messages.context_processors.messages",
77+
],
78+
},
79+
},
80+
]
81+
82+
WSGI_APPLICATION = "core.wsgi.application"
83+
84+
85+
# Database
86+
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
87+
88+
DB_ENGINE = os.getenv('DB_ENGINE' , None)
89+
DB_USERNAME = os.getenv('DB_USERNAME' , None)
90+
DB_PASS = os.getenv('DB_PASS' , None)
91+
DB_HOST = os.getenv('DB_HOST' , None)
92+
DB_PORT = os.getenv('DB_PORT' , None)
93+
DB_NAME = os.getenv('DB_NAME' , None)
94+
95+
if DB_ENGINE and DB_NAME and DB_USERNAME:
96+
DATABASES = {
97+
'default': {
98+
'ENGINE' : 'django.db.backends.' + DB_ENGINE,
99+
'NAME' : DB_NAME,
100+
'USER' : DB_USERNAME,
101+
'PASSWORD': DB_PASS,
102+
'HOST' : DB_HOST,
103+
'PORT' : DB_PORT,
104+
},
105+
}
106+
else:
107+
DATABASES = {
108+
'default': {
109+
'ENGINE': 'django.db.backends.sqlite3',
110+
'NAME': 'db.sqlite3',
111+
}
112+
}
113+
114+
# Password validation
115+
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
116+
117+
AUTH_PASSWORD_VALIDATORS = [
118+
{
119+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
120+
},
121+
{
122+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
123+
},
124+
{
125+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
126+
},
127+
{
128+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
129+
},
130+
]
131+
132+
133+
# Internationalization
134+
# https://docs.djangoproject.com/en/4.1/topics/i18n/
135+
136+
LANGUAGE_CODE = "en-us"
137+
138+
TIME_ZONE = "UTC"
139+
140+
USE_I18N = True
141+
142+
USE_TZ = True
143+
144+
145+
# Static files (CSS, JavaScript, Images)
146+
# https://docs.djangoproject.com/en/4.1/howto/static-files/
147+
148+
STATIC_URL = '/static/'
149+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
150+
151+
#if not DEBUG:
152+
# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
153+
154+
# Default primary key field type
155+
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
156+
157+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
158+
159+
LOGIN_REDIRECT_URL = '/'
160+
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

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 include, path
18+
19+
urlpatterns = [
20+
path('', include('home.urls')),
21+
path("admin/", admin.site.urls),
22+
path("", include('theme_material_kit.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)