-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac0c6cd
commit b2501e6
Showing
26 changed files
with
516 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.pyc | ||
*.DS_Store | ||
*.egg* | ||
/dist/ | ||
/.idea | ||
/docs/_build/ | ||
/node_modules/ | ||
build/ | ||
env | ||
/staticfiles/ | ||
|
||
#src | ||
*.sqlite* | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM python:3.9 | ||
|
||
# set environment variables | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
COPY requirements.txt . | ||
# install python dependencies | ||
RUN pip install --upgrade pip | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
COPY . . | ||
|
||
# running migrations | ||
RUN python manage.py migrate | ||
|
||
# gunicorn | ||
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# [Django Material Dashboard](https://appseed.us/product/material-dashboard/django/) | ||
|
||
Open-source **Django** project crafted on top of **Material Dashboard**, an open-source `Boostrap 5` design from [Creative-Tim](https://bit.ly/3fKQZaL) | ||
The product is designed to deliver the best possible user experience with highly customizable feature-rich pages. `Material Material` has easy and intuitive responsive design whether it is viewed on retina screens or laptops. | ||
|
||
- 👉 [Django Material Dashboard](https://appseed.us/product/material-dashboard/django/) - `Product page` | ||
- 👉 [Django Material Dashboard](https://django-material-dashboard.onrender.com) - `LIVE Demo` | ||
- 🚀 Free [Support](https://appseed.us/support/) via `Email` & `Discord` | ||
|
||
<br /> | ||
|
||
> Features: | ||
- ✅ `Up-to-date Dependencies` | ||
- ✅ Theme: [Django Admin Material](https://github.com/app-generator/django-admin-material-dashboard) | ||
- ✅ **Authentication**: `Django.contrib.AUTH`, Registration | ||
- 🚀 `Deployment` | ||
- `CI/CD` flow via `Render` | ||
- [Go LIVE with Django Material Dashboard](https://www.youtube.com/watch?v=ShQKSf5y7mI) - `video presentation` | ||
|
||
<br /> | ||
|
||
 | ||
|
||
<br /> | ||
|
||
## Manual Build | ||
|
||
> 👉 Download the code | ||
```bash | ||
$ git clone https://github.com/app-generator/django-material-dashboard.git | ||
$ cd django-material-dashboard | ||
``` | ||
|
||
<br /> | ||
|
||
> 👉 Install modules via `VENV` | ||
```bash | ||
$ virtualenv env | ||
$ source env/bin/activate | ||
$ pip install -r requirements.txt | ||
``` | ||
|
||
<br /> | ||
|
||
> 👉 Set Up Database | ||
```bash | ||
$ python manage.py makemigrations | ||
$ python manage.py migrate | ||
``` | ||
|
||
<br /> | ||
|
||
> 👉 Create the Superuser | ||
```bash | ||
$ python manage.py createsuperuser | ||
``` | ||
|
||
<br /> | ||
|
||
> 👉 Start the app | ||
```bash | ||
$ python manage.py runserver | ||
``` | ||
|
||
At this point, the app runs at `http://127.0.0.1:8000/`. | ||
|
||
<br /> | ||
|
||
## Screenshots | ||
|
||
This design is a pixel-perfect [Bootstrap 5](https://www.admin-dashboards.com/bootstrap-5-templates/) Dashboard with a fresh, new design inspired by Google's Material Design. **Material Dashboard** is built with over 60 frontend individual elements, like buttons, inputs, navbars, nav tabs, cards, or alerts, giving you the freedom of choosing and combining. | ||
|
||
<br /> | ||
|
||
> **[Django Admin Material](https://github.com/app-generator/django-admin-material-dashboard)** - `Admin Section` | ||
 | ||
|
||
<br /> | ||
|
||
> **[Django Admin Material](https://github.com/app-generator/django-admin-material-dashboard)** - `Admin Widgets` | ||
 | ||
|
||
<br /> | ||
|
||
--- | ||
[Django Material Dashboard](https://appseed.us/product/material-dashboard/django/) - Minimal **Django** core provided by **[AppSeed](https://appseed.us/)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# How to deploy on `Render` | ||
|
||
> This document should contains all the steps to deploy the app on render without much effort, using PostgreSQL | ||
https://render.com/docs/deploy-django | ||
|
||
## ALL STEPS below | ||
|
||
<br /> | ||
|
||
### 👉 Create `PostgreSQL` database on render | ||
- Go to https://dashboard.render.com/new/database this link. | ||
- Database name should be `berry`. | ||
- Keep the Database, User and Datadog API Key as it is. | ||
- If you want to change database name anything else then you have to change your `render.yaml` file database name too. | ||
|
||
<br /> | ||
|
||
### 👉 Create a Blueprint instance | ||
- Go to https://dashboard.render.com/blueprints this link. | ||
- Click `New Blueprint Instance` button. | ||
- Connect your `repo` which you want to deploy. | ||
- Fill the `Service Group Name` and click on `Update Existing Resources` button. | ||
- After that your deployment will start automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
# exit on error | ||
set -o errexit | ||
|
||
python -m pip install --upgrade pip | ||
|
||
pip install -r requirements.txt | ||
|
||
python manage.py collectstatic --no-input | ||
python manage.py migrate |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
ASGI config for core project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings") | ||
|
||
application = get_asgi_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
""" | ||
Django settings for core project. | ||
Generated by 'django-admin startproject' using Django 4.1.2. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.1/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/4.1/ref/settings/ | ||
""" | ||
|
||
import os, random, string | ||
from pathlib import Path | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() # take environment variables from .env. | ||
|
||
# Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
BASE_DIR = Path(__file__).resolve().parent.parent | ||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = os.environ.get('SECRET_KEY') | ||
if not SECRET_KEY: | ||
SECRET_KEY = ''.join(random.choice( string.ascii_lowercase ) for i in range( 32 )) | ||
|
||
# Render Deployment Code | ||
DEBUG = 'RENDER' not in os.environ | ||
|
||
ALLOWED_HOSTS = [] | ||
|
||
RENDER_EXTERNAL_HOSTNAME = os.environ.get('RENDER_EXTERNAL_HOSTNAME') | ||
if RENDER_EXTERNAL_HOSTNAME: | ||
ALLOWED_HOSTS.append(RENDER_EXTERNAL_HOSTNAME) | ||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'admin_material.apps.AdminMaterialDashboardConfig', | ||
"django.contrib.admin", | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.messages", | ||
"django.contrib.staticfiles", | ||
|
||
"home", | ||
] | ||
|
||
MIDDLEWARE = [ | ||
"django.middleware.security.SecurityMiddleware", | ||
"whitenoise.middleware.WhiteNoiseMiddleware", | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.middleware.common.CommonMiddleware", | ||
"django.middleware.csrf.CsrfViewMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
"django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
] | ||
|
||
ROOT_URLCONF = "core.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", | ||
"django.contrib.auth.context_processors.auth", | ||
"django.contrib.messages.context_processors.messages", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = "core.wsgi.application" | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases | ||
|
||
DB_ENGINE = os.getenv('DB_ENGINE' , None) | ||
DB_USERNAME = os.getenv('DB_USERNAME' , None) | ||
DB_PASS = os.getenv('DB_PASS' , None) | ||
DB_HOST = os.getenv('DB_HOST' , None) | ||
DB_PORT = os.getenv('DB_PORT' , None) | ||
DB_NAME = os.getenv('DB_NAME' , None) | ||
|
||
if DB_ENGINE and DB_NAME and DB_USERNAME: | ||
DATABASES = { | ||
'default': { | ||
'ENGINE' : 'django.db.backends.' + DB_ENGINE, | ||
'NAME' : DB_NAME, | ||
'USER' : DB_USERNAME, | ||
'PASSWORD': DB_PASS, | ||
'HOST' : DB_HOST, | ||
'PORT' : DB_PORT, | ||
}, | ||
} | ||
else: | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': 'db.sqlite3', | ||
} | ||
} | ||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", | ||
}, | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", | ||
}, | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", | ||
}, | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", | ||
}, | ||
] | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/4.1/topics/i18n/ | ||
|
||
LANGUAGE_CODE = "en-us" | ||
|
||
TIME_ZONE = "UTC" | ||
|
||
USE_I18N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/4.1/howto/static-files/ | ||
|
||
STATIC_URL = '/static/' | ||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') | ||
|
||
#if not DEBUG: | ||
# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' | ||
|
||
# Default primary key field type | ||
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" | ||
|
||
LOGIN_REDIRECT_URL = '/' | ||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""core URL Configuration | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/4.1/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.contrib import admin | ||
from django.urls import include, path | ||
|
||
urlpatterns = [ | ||
path('', include('home.urls')), | ||
path("admin/", admin.site.urls), | ||
path("", include('admin_material.urls')) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
WSGI config for core 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/4.1/howto/deployment/wsgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.wsgi import get_wsgi_application | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings") | ||
|
||
application = get_wsgi_application() |
Oops, something went wrong.