Skip to content

Commit f67f701

Browse files
author
App Generator
committed
Bump Codebase Version
1 parent 466a3b0 commit f67f701

File tree

303 files changed

+50880
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+50880
-0
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SECRET_KEY=S3cr3t_K#Key

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
flask/
2+
*.pyc
3+
dev
4+
node_modules
5+
app/database.db
6+
app/build
7+
yarn.lock
8+
yarn-error.log
9+
*.psd
10+
env/
11+
env__/
12+
.vscode/symbols.json
13+
app/db.sqlite3
14+
15+
app/static/assets/node_modules
16+
app/static/assets/yarn.lock
17+
app/static/assets/.temp

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM python:3.9
2+
3+
COPY . .
4+
5+
# set environment variables
6+
ENV PYTHONDONTWRITEBYTECODE 1
7+
ENV PYTHONUNBUFFERED 1
8+
9+
# install python dependencies
10+
RUN pip install --upgrade pip
11+
RUN pip install --no-cache-dir -r requirements.txt
12+
13+
# gunicorn
14+
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "run:app"]

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn run:app --log-file=-

app/__init__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- encoding: utf-8 -*-
2+
"""
3+
Copyright (c) 2019 - present AppSeed.us
4+
"""
5+
6+
import os
7+
8+
from flask import Flask
9+
from flask_sqlalchemy import SQLAlchemy
10+
from flask_login import LoginManager
11+
from flask_bcrypt import Bcrypt
12+
13+
# Grabs the folder where the script runs.
14+
basedir = os.path.abspath(os.path.dirname(__file__))
15+
16+
app = Flask(__name__)
17+
18+
app.config.from_object('app.config.Config')
19+
20+
db = SQLAlchemy (app) # flask-sqlalchemy
21+
bc = Bcrypt (app) # flask-bcrypt
22+
23+
lm = LoginManager( ) # flask-loginmanager
24+
lm.init_app(app) # init the login manager
25+
26+
# Setup database
27+
@app.before_first_request
28+
def initialize_database():
29+
db.create_all()
30+
31+
# Import routing, models and Start the App
32+
from app import views, models

app/config.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- encoding: utf-8 -*-
2+
"""
3+
Copyright (c) 2019 - present AppSeed.us
4+
"""
5+
6+
import os
7+
from decouple import config
8+
9+
# Grabs the folder where the script runs.
10+
basedir = os.path.abspath(os.path.dirname(__file__))
11+
12+
class Config():
13+
14+
CSRF_ENABLED = True
15+
16+
# Set up the App SECRET_KEY
17+
SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_007')
18+
19+
# This will create a file in <app> FOLDER
20+
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3')
21+
SQLALCHEMY_TRACK_MODIFICATIONS = False

app/forms.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- encoding: utf-8 -*-
2+
"""
3+
Copyright (c) 2019 - present AppSeed.us
4+
"""
5+
6+
from flask_wtf import FlaskForm
7+
from flask_wtf.file import FileField, FileRequired
8+
from wtforms import StringField, TextAreaField, SubmitField, PasswordField
9+
from wtforms.validators import InputRequired, Email, DataRequired
10+
11+
class LoginForm(FlaskForm):
12+
username = StringField (u'Username' , validators=[DataRequired()])
13+
password = PasswordField(u'Password' , validators=[DataRequired()])
14+
15+
class RegisterForm(FlaskForm):
16+
name = StringField (u'Name' )
17+
username = StringField (u'Username' , validators=[DataRequired()])
18+
password = PasswordField(u'Password' , validators=[DataRequired()])
19+
email = StringField (u'Email' , validators=[DataRequired(), Email()])

app/models.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- encoding: utf-8 -*-
2+
"""
3+
Copyright (c) 2019 - present AppSeed.us
4+
"""
5+
6+
from app import db
7+
from flask_login import UserMixin
8+
9+
class Users(db.Model, UserMixin):
10+
11+
__tablename__ = 'Users'
12+
13+
id = db.Column(db.Integer, primary_key=True)
14+
user = db.Column(db.String(64), unique = True)
15+
email = db.Column(db.String(120), unique = True)
16+
password = db.Column(db.String(500))
17+
18+
def __init__(self, user, email, password):
19+
self.user = user
20+
self.password = password
21+
self.email = email
22+
23+
def __repr__(self):
24+
return str(self.id) + ' - ' + str(self.user)
25+
26+
def save(self):
27+
28+
# inject self into db session
29+
db.session.add ( self )
30+
31+
# commit change and save the object
32+
db.session.commit( )
33+
34+
return self

0 commit comments

Comments
 (0)