-
Notifications
You must be signed in to change notification settings - Fork 31
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
Adi Chirilov
committed
Sep 7, 2019
1 parent
54b684f
commit 0818c96
Showing
243 changed files
with
27,034 additions
and
1 deletion.
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,9 @@ | ||
flask/ | ||
*.pyc | ||
dev | ||
node_modules | ||
app/database.db | ||
app/build | ||
yarn.lock | ||
yarn-error.log | ||
*.psd |
File renamed without changes.
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 |
---|---|---|
@@ -1 +1,57 @@ | ||
# flask-material-kit | ||
# [Flask Material Kit](https://flask-material-kit.appseed.us/) | ||
|
||
Open-Source [Flask](https://palletsprojects.com/p/flask/) app enhanced with [SQLite](https://www.sqlite.org/index.html) database, authentication, [SQLAlchemy ORM](https://www.sqlalchemy.org/) and a beautiful UI - [Material Kit Design](https://www.creative-tim.com/product/material-kit) by Creative-Tim. | ||
|
||
<br /> | ||
|
||
![Flask Material Kit - Gif animated intro.](https://github.com/app-generator/static/blob/master/products/flask-material-kit-intro.gif?raw=true) | ||
|
||
<br /> | ||
|
||
## How to use it | ||
|
||
To use the app, please execute the commands: | ||
|
||
```bash | ||
$ # clone the repo | ||
|
||
$ git clone https://github.com/app-generator/flask-material-kit.git | ||
$ cd flask-material-kit | ||
|
||
$ # install the dependencies | ||
$ pip install -r requirements.txt | ||
|
||
$ # create the database (using Flask shell) | ||
|
||
$ flask shell | ||
$ >>> from app import db | ||
$ >>> db.create_all() | ||
|
||
$ flask run | ||
|
||
$ # App is running on http://localhost:5000 | ||
``` | ||
|
||
<br /> | ||
|
||
## Support | ||
|
||
**LIVE support** via [Discord](https://discord.gg/fZC6hup) for [Paid Plans](https://appseed.us/pricing). | ||
|
||
<br /> | ||
|
||
![Flask Material Kit - Gif animated intro.](https://github.com/app-generator/static/blob/master/products/flask-material-kit-pages-intro.gif?raw=true) | ||
|
||
<br /> | ||
|
||
## Links & Resources | ||
|
||
- [Flask Material Kit](https://github.com/app-generator/flask-material-kit) - live demo | ||
- [Material Kit Design](https://www.creative-tim.com/product/material-kit) - the design provided by Creative-Tim | ||
- [Flask](https://palletsprojects.com/p/flask/) - offcial website | ||
- A curated list with production-ready [Flask Apps](https://appseed.us/apps/flask-apps) | ||
|
||
<br /> | ||
|
||
--- | ||
[Flask Material Kit](https://flask-material-kit.appseed.us/) - provided by **AppSeed** |
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 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: MIT | ||
For more apps please access https://appseed.us/ | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
import os | ||
from app import app | ||
from app import db | ||
|
||
#---------------------------------------- | ||
# launch | ||
#---------------------------------------- | ||
|
||
if __name__ == "__main__": | ||
db.create_all() | ||
|
||
port = int(os.environ.get("PORT", 5000)) | ||
app.run(host='0.0.0.0', port=port, debug=True) | ||
#app.run(ssl_context='adhoc') | ||
|
||
|
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,36 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: commercial | ||
Read more at https://appseed.us/pricing | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from flask import Flask | ||
from flask_bootstrap import Bootstrap | ||
from flask_sqlalchemy import SQLAlchemy | ||
from flask_login import LoginManager | ||
from flask_bcrypt import Bcrypt | ||
from flask_mail import Mail | ||
|
||
|
||
# load RES | ||
from . data import Data | ||
|
||
app = Flask(__name__, static_url_path='/static') | ||
|
||
#Configuration of application, see configuration.py, choose one and uncomment. | ||
#app.config.from_object('app.configuration.ProductionConfig') | ||
app.config.from_object('app.configuration.DevelopmentConfig') | ||
|
||
# Expose globals to Jinja2 templates | ||
app.add_template_global( app.config , 'cfg' ) | ||
app.add_template_global( Data , 'data' ) | ||
|
||
db = SQLAlchemy (app) #flask-sqlalchemy | ||
lm = LoginManager( ) #flask-loginmanager | ||
bc = Bcrypt (app) #flask-bcrypt | ||
|
||
lm.init_app(app) # init the login manager | ||
|
||
from app import views, models |
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,46 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: MIT | ||
For more apps please access https://appseed.us/ | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
import datetime,time,os,re | ||
from sqlalchemy import desc,or_ | ||
|
||
from flask_frozen import Freezer | ||
|
||
from app import app, lm, db, bc | ||
from . common import COMMON, DATATYPE | ||
from . models import User | ||
|
||
def export_static(): | ||
freezer = Freezer(app) | ||
freezer.freeze() | ||
|
||
def create_user( email, name, username, password): | ||
|
||
# regex to check for e-mail syntax | ||
if not re.match("(^.+@{1}.+\.{1}.+)", str(email)): | ||
|
||
print("Invalid e-mail. Please try again.") | ||
return None | ||
#return "Invalid e-mail. Please try again." | ||
|
||
# hash the password here (bcrypt has salting included) | ||
pw_hash = bc.generate_password_hash(password) | ||
|
||
# if form is valid and all verification is complete | ||
# create User object and give the parameters in order | ||
user = User(username, pw_hash, name, email) | ||
|
||
user.save() | ||
|
||
print( "user created ok: " + str( user.id ) ) | ||
return user | ||
|
||
# @ToDo - to be moved in a test file | ||
def create_test_users(): | ||
create_user( 'test@yahoo.com', 'Test User', 'test', 'pass1234') | ||
|
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,36 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: MIT | ||
For more apps please access https://appseed.us/ | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
import time,datetime,calendar | ||
import os | ||
import base64 | ||
|
||
#import util <--- DO NOT do this, we have circular inclusion .. | ||
|
||
class STATUS: | ||
|
||
OK = 0 # all ok | ||
ERR = 1 # generic err | ||
ERR_AUTH = 2 # auth err | ||
ERR_INPUT = 3 # wrong input | ||
|
||
# Class for constants & data types .. | ||
class COMMON: | ||
|
||
NOT_SET = -1 | ||
|
||
class DATATYPE: | ||
NOT_SET = -1 | ||
TEXT = 0 | ||
HTML = 1 | ||
JSON = 2 | ||
COUNT = 3 | ||
OBJ_TYPE = 4 | ||
CRYPTED = 5 | ||
|
||
|
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,67 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: MIT | ||
For more apps please access https://appseed.us/ | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
import os | ||
|
||
# Grabs the folder where the script runs. | ||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
# Only cfg is here .. | ||
class AppConfig(object): | ||
|
||
THEME = 'phantom' # 'argon-dashboard' | ||
|
||
STATIC = 'static' | ||
DATE_FORMAT = '%Y-%m-%d' | ||
SECRET_KEY = "SuperSecret_77554##@3" # save yours here | ||
|
||
class Config(AppConfig): | ||
""" | ||
Configuration base, for all environments. | ||
""" | ||
DEBUG = False | ||
TESTING = False | ||
BOOTSTRAP_FONTAWESOME = True | ||
CSRF_ENABLED = True | ||
|
||
SQLALCHEMY_TRACK_MODIFICATIONS = False | ||
|
||
class ProductionConfig(Config): | ||
|
||
APP = 'PATH_FOR_PRODUCTION' | ||
APP_IMG_FOLDER = os.path.join( APP, 'static', 'images' ) | ||
|
||
# RECAPTCHA keys (production) | ||
RECAPTCHA_PUBLIC_KEY = "1234_abcd" | ||
RECAPTCHA_PRIVATE_KEY = "1234_xyzw" | ||
|
||
#SQLALCHEMY_DATABASE_URI = "mysql+pymysql://db_user:db_pass@localhost/db_name" | ||
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'database.db') | ||
|
||
SERVER_NAME = 'www.yourdomain.us' | ||
DEBUG = False | ||
TESTING = False | ||
|
||
class DevelopmentConfig(Config): | ||
|
||
APP = 'app' | ||
APP_IMG_FOLDER = os.path.join( APP, 'static', 'images' ) | ||
|
||
# keys for dev [ http://localhost ] | ||
RECAPTCHA_PUBLIC_KEY = "1234_abcd" | ||
RECAPTCHA_PRIVATE_KEY = "1234_xyzw" | ||
|
||
#SQLALCHEMY_DATABASE_URI = "mysql+pymysql://MYSQL_USER:MYSQL_PASS@localhost/MYSQL_DATABASE" | ||
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'database.db') | ||
|
||
SERVER_NAME = 'localhost:5000' | ||
DEBUG = False | ||
TESTING = False | ||
FORCE_HTTPS = False | ||
|
||
|
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,31 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: MIT | ||
For more apps please access https://appseed.us/ | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
# Resources used | ||
class Data: | ||
|
||
copy = 'AppSeed' | ||
|
||
email = 'support@appseed.us' | ||
design = 'Material Design by Creative-Tim' | ||
|
||
seo_title = 'Flask App - Material Design by Creative-Tim | AppSeed' | ||
seo_desc = 'Open-Source Flask app with Material Design enhanced with authentication, SQLite database and tooling.' | ||
seo_keys = 'flask, paper kit, creative-tim, appseed' | ||
|
||
product = 'https://github.com/app-generator/flask-material-kit' | ||
github = 'https://github.com/app-generator/flask-material-kit' | ||
docs = 'https://docs.appseed.us/apps/flask-apps/flask-material-kit/' | ||
appseed = 'https://appseed.us' | ||
generator = 'https://appseed.us/app-generator' | ||
blog = 'https://blog.appseed.us/' | ||
facebook = 'https://facebook.com/webappseed' | ||
twitter = 'https://twitter.com/webappseed' | ||
instagram = 'https://instagram.com/webappseed' | ||
support = 'https://appseed.us/support' | ||
discord = 'https://discord.gg/fZC6hup' |
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,22 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: MIT | ||
For more apps please access https://appseed.us/ | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from flask_wtf import FlaskForm, RecaptchaField | ||
from flask_wtf.file import FileField, FileRequired | ||
from wtforms import StringField, TextAreaField, SubmitField, PasswordField | ||
from wtforms.validators import InputRequired, Email, DataRequired | ||
|
||
class LoginForm(FlaskForm): | ||
username = StringField (u'Username' , validators=[DataRequired()]) | ||
password = PasswordField(u'Password' , validators=[DataRequired()]) | ||
|
||
class RegisterForm(FlaskForm): | ||
username = StringField (u'Username') | ||
password = PasswordField(u'Password' , validators=[DataRequired()]) | ||
email = StringField (u'Email' , validators=[DataRequired(), Email()]) | ||
name = StringField (u'Name' , validators=[DataRequired()]) |
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,46 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Fully Coded App by AppSeed.us | ||
License: MIT | ||
For more apps please access https://appseed.us/ | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from app import db | ||
from flask_login import UserMixin | ||
|
||
from . common import COMMON, STATUS, DATATYPE | ||
|
||
class User(UserMixin, db.Model): | ||
|
||
id = db.Column(db.Integer, primary_key=True) | ||
user = db.Column(db.String(64), unique = True) | ||
email = db.Column(db.String(120), unique = True) | ||
name = db.Column(db.String(500)) | ||
role = db.Column(db.Integer) | ||
password = db.Column(db.String(500)) | ||
password_q = db.Column(db.Integer) | ||
|
||
def __init__(self, user, password, name, email): | ||
self.user = user | ||
self.password = password | ||
self.password_q = DATATYPE.CRYPTED | ||
self.name = name | ||
self.email = email | ||
|
||
self.group_id = None | ||
self.role = None | ||
|
||
def __repr__(self): | ||
return '<User %r>' % (self.id) | ||
|
||
def save(self): | ||
|
||
# inject self into db session | ||
db.session.add ( self ) | ||
|
||
# commit change and save the object | ||
db.session.commit( ) | ||
|
||
return self | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.