forked from app-generator/django-material-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
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
App Generator
committed
Jan 13, 2021
1 parent
a87ab85
commit 3d51678
Showing
272 changed files
with
59,915 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,3 @@ | ||
DEBUG=True | ||
SECRET_KEY=S3cr3t_K#Key | ||
SERVER=django-material-dashboard.appseed-srv1.com |
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,26 @@ | ||
# byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# tests and coverage | ||
*.pytest_cache | ||
.coverage | ||
|
||
# database & logs | ||
*.db | ||
*.sqlite3 | ||
*.log | ||
|
||
# venv | ||
env | ||
venv | ||
|
||
# other | ||
.DS_Store | ||
|
||
# javascript | ||
package-lock.json | ||
|
||
staticfiles/* | ||
!staticfiles/.gitkeep | ||
.vscode/symbols.json |
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,14 @@ | ||
FROM python:3.6 | ||
|
||
COPY manage.py gunicorn-cfg.py requirements.txt .env ./ | ||
COPY app app | ||
COPY authentication authentication | ||
COPY core core | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
RUN python manage.py makemigrations | ||
RUN python manage.py migrate | ||
|
||
EXPOSE 5005 | ||
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,32 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2019 - present [AppSeed](http://appseed.us/) | ||
|
||
<br /> | ||
|
||
## Licensing Information | ||
|
||
<br /> | ||
|
||
| Item | - | | ||
| ---------------------------------- | --- | | ||
| License Type | MIT | | ||
| Use for print | **YES** | | ||
| Create single personal website/app | **YES** | | ||
| Create single website/app for client | **YES** | | ||
| Create multiple website/apps for clients | **YES** | | ||
| Create multiple SaaS applications | **YES** | | ||
| End-product paying users | **YES** | | ||
| Product sale | **YES** | | ||
| Remove footer credits | **YES** | | ||
| --- | --- | | ||
| Remove copyright mentions from source code | NO | | ||
| Production deployment assistance | NO | | ||
| Create HTML/CSS template for sale | NO | | ||
| Create Theme/Template for CMS for sale | NO | | ||
| Separate sale of our UI Elements | NO | | ||
|
||
<br /> | ||
|
||
--- | ||
For more information regarding licensing, please contact the AppSeed Service < *support@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 @@ | ||
web: gunicorn core.wsgi --log-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,4 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present 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,8 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.contrib import admin | ||
|
||
# Register your models here. |
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,9 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.apps import AppConfig | ||
|
||
class MyConfig(AppConfig): | ||
name = 'cfg' |
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,4 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present 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,10 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.db import models | ||
from django.contrib.auth.models import User | ||
|
||
# Create your models here. | ||
|
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,8 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,17 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.urls import path, re_path | ||
from app import views | ||
|
||
urlpatterns = [ | ||
|
||
# The home page | ||
path('', views.index, name='home'), | ||
|
||
# Matches any html file | ||
re_path(r'^.*\.*', views.pages, name='pages'), | ||
|
||
] |
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,42 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.contrib.auth.decorators import login_required | ||
from django.shortcuts import render, get_object_or_404, redirect | ||
from django.template import loader | ||
from django.http import HttpResponse | ||
from django import template | ||
|
||
@login_required(login_url="/login/") | ||
def index(request): | ||
|
||
context = {} | ||
context['segment'] = 'index' | ||
|
||
html_template = loader.get_template( 'index.html' ) | ||
return HttpResponse(html_template.render(context, request)) | ||
|
||
@login_required(login_url="/login/") | ||
def pages(request): | ||
context = {} | ||
# All resource paths end in .html. | ||
# Pick out the html file name from the url. And load that template. | ||
try: | ||
|
||
load_template = request.path.split('/')[-1] | ||
context['segment'] = load_template | ||
|
||
html_template = loader.get_template( load_template ) | ||
return HttpResponse(html_template.render(context, request)) | ||
|
||
except template.TemplateDoesNotExist: | ||
|
||
html_template = loader.get_template( 'page-404.html' ) | ||
return HttpResponse(html_template.render(context, request)) | ||
|
||
except: | ||
|
||
html_template = loader.get_template( 'page-500.html' ) | ||
return HttpResponse(html_template.render(context, request)) |
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,4 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present 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,8 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.contrib import admin | ||
|
||
# Register your models here. |
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,9 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.apps import AppConfig | ||
|
||
class AuthConfig(AppConfig): | ||
name = 'authcfg' |
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,58 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django import forms | ||
from django.contrib.auth.forms import UserCreationForm | ||
from django.contrib.auth.models import User | ||
|
||
class LoginForm(forms.Form): | ||
username = forms.CharField( | ||
widget=forms.TextInput( | ||
attrs={ | ||
"placeholder" : "Username", | ||
"class": "form-control" | ||
} | ||
)) | ||
password = forms.CharField( | ||
widget=forms.PasswordInput( | ||
attrs={ | ||
"placeholder" : "Password", | ||
"class": "form-control" | ||
} | ||
)) | ||
|
||
class SignUpForm(UserCreationForm): | ||
username = forms.CharField( | ||
widget=forms.TextInput( | ||
attrs={ | ||
"placeholder" : "Username", | ||
"class": "form-control" | ||
} | ||
)) | ||
email = forms.EmailField( | ||
widget=forms.EmailInput( | ||
attrs={ | ||
"placeholder" : "Email", | ||
"class": "form-control" | ||
} | ||
)) | ||
password1 = forms.CharField( | ||
widget=forms.PasswordInput( | ||
attrs={ | ||
"placeholder" : "Password", | ||
"class": "form-control" | ||
} | ||
)) | ||
password2 = forms.CharField( | ||
widget=forms.PasswordInput( | ||
attrs={ | ||
"placeholder" : "Password check", | ||
"class": "form-control" | ||
} | ||
)) | ||
|
||
class Meta: | ||
model = User | ||
fields = ('username', 'email', 'password1', 'password2') |
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,4 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present 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,8 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.db import models | ||
|
||
# Create your models here. |
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,8 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,14 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.urls import path | ||
from .views import login_view, register_user | ||
from django.contrib.auth.views import LogoutView | ||
|
||
urlpatterns = [ | ||
path('login/', login_view, name="login"), | ||
path('register/', register_user, name="register"), | ||
path("logout/", LogoutView.as_view(), name="logout") | ||
] |
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,60 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from django.shortcuts import render | ||
|
||
# Create your views here. | ||
from django.shortcuts import render, redirect | ||
from django.contrib.auth import authenticate, login | ||
from django.contrib.auth.models import User | ||
from django.forms.utils import ErrorList | ||
from django.http import HttpResponse | ||
from .forms import LoginForm, SignUpForm | ||
|
||
def login_view(request): | ||
form = LoginForm(request.POST or None) | ||
|
||
msg = None | ||
|
||
if request.method == "POST": | ||
|
||
if form.is_valid(): | ||
username = form.cleaned_data.get("username") | ||
password = form.cleaned_data.get("password") | ||
user = authenticate(username=username, password=password) | ||
if user is not None: | ||
login(request, user) | ||
return redirect("/") | ||
else: | ||
msg = 'Invalid credentials' | ||
else: | ||
msg = 'Error validating the form' | ||
|
||
return render(request, "accounts/login.html", {"form": form, "msg" : msg}) | ||
|
||
def register_user(request): | ||
|
||
msg = None | ||
success = False | ||
|
||
if request.method == "POST": | ||
form = SignUpForm(request.POST) | ||
if form.is_valid(): | ||
form.save() | ||
username = form.cleaned_data.get("username") | ||
raw_password = form.cleaned_data.get("password1") | ||
user = authenticate(username=username, password=raw_password) | ||
|
||
msg = 'User created - please <a href="/login">login</a>.' | ||
success = True | ||
|
||
#return redirect("/login/") | ||
|
||
else: | ||
msg = 'Form is not valid' | ||
else: | ||
form = SignUpForm() | ||
|
||
return render(request, "accounts/register.html", {"form": form, "msg" : msg, "success" : success }) |
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,4 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present 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,12 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') | ||
|
||
application = get_asgi_application() |
Oops, something went wrong.