forked from app-generator/flask-neumorphism-uikit
-
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
0 parents
commit f45579d
Showing
2,297 changed files
with
81,661 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 @@ | ||
SECRET_KEY=S3cr3t_K#Key |
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,13 @@ | ||
flask/ | ||
*.pyc | ||
dev | ||
node_modules | ||
app/database.db | ||
app/build | ||
yarn.lock | ||
yarn-error.log | ||
*.psd | ||
env/ | ||
env__/ | ||
.vscode/symbols.json | ||
app/db.sqlite3 |
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 @@ | ||
# Change Log | ||
|
||
## [1.0.2] 2020-06-02 | ||
### Improvements | ||
- Added deploy scripts: Docker, Gunicorn | ||
- Added `.env` | ||
- Added `python-decouple` in `requirements.txt` | ||
- Update Sample UI Kit - [Neumorphism UI](https://themesberg.com/product/ui-kits/neumorphism-ui) by Themesberg | ||
|
||
## [1.0.1] 2020-05-30 | ||
### Improvements | ||
- Update Licensing information | ||
- Add CHANGELOG.md to track all changes | ||
- Minor update in README | ||
|
||
## [1.0.0] 2020-02-07 | ||
### Initial Release |
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,11 @@ | ||
FROM python:3.6 | ||
|
||
ENV FLASK_APP run.py | ||
|
||
COPY run.py gunicorn-cfg.py requirements.txt .env ./ | ||
COPY app app | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
EXPOSE 5005 | ||
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "run:app"] |
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 @@ | ||
# 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 | | ||
| 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 < *[email protected]* > |
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,33 @@ | ||
# Commercial License | ||
|
||
Copyright (c) 2019 - present [AppSeed](http://appseed.us/) | ||
|
||
<br /> | ||
|
||
## Licensing Information | ||
|
||
All commercial web apps (including this one) provided by AppSeed are released under two configurations: | ||
|
||
<br /> | ||
|
||
### [Personal License](https://github.com/app-generator/license-personal) | ||
|
||
> For full information please access [Personal License](https://github.com/app-generator/license-personal) | ||
- Create single personal website/app | ||
- Create single website/app for client | ||
|
||
<br /> | ||
|
||
### [Developer License](https://github.com/app-generator/license-developer) | ||
|
||
> For full information please access [Developer License](https://github.com/app-generator/license-developer) | ||
- Create multiple personal websites/apps | ||
- Create multiple websites/apps for clients | ||
- Create single SaaS application | ||
|
||
<br /> | ||
|
||
--- | ||
For more information regarding licensing, please contact the AppSeed Service < *[email protected]* > |
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 run:app --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,192 @@ | ||
# [Boierplate Code Flask](https://appseed.us/boilerplate-code/flask) | ||
|
||
> Template [boilerplate code](https://appseed.us/boilerplate-code) used by [AppSeed](https://appseed.us) to generate simple web apps coded in [Flask](https://palletsprojects.com/p/flask/) | ||
## Features | ||
|
||
- UI Kit: **Neumorphism UI** by **Themesberg** | ||
- UI-Ready, Jinja2 templating | ||
- SQLite database, Flask-SQLAlchemy ORM | ||
- Session-Based auth flow (login, register) | ||
- **[MIT License](https://github.com/app-generator/license-mit)** | ||
- Free support via **Github** issues tracker | ||
- Paid 24/7 Live Support via [Discord](https://discord.gg/fZC6hup). | ||
|
||
> Links | ||
- [Boierplate Code Flask](https://boilerplate-code-flask.appseed.us/) - LIVE Demo | ||
- [Boierplate Code Flask](https://appseed.us/boilerplate-code/flask) - Official product page | ||
- More [Flask Apps](https://appseed.us/apps/flask-apps) - index hosted by **[AppSeed](https://appseed.us)** | ||
- [Flask Admin Dashboards](https://appseed.us/admin-dashboards/flask) - index hosted by **[AppSeed](https://appseed.us)** | ||
|
||
<br /> | ||
|
||
 | ||
|
||
<br /> | ||
|
||
## Build from sources | ||
|
||
```bash | ||
$ # Clone the sources | ||
$ git clone https://github.com/app-generator/boilerplate-code-flask.git | ||
$ cd boilerplate-code-flask | ||
$ | ||
$ # Virtualenv modules installation (Unix based systems) | ||
$ virtualenv env | ||
$ source env/bin/activate | ||
$ | ||
$ # Virtualenv modules installation (Windows based systems) | ||
$ # virtualenv env | ||
$ # .\env\Scripts\activate | ||
$ | ||
$ # Install requirements | ||
$ pip3 install -r requirements.txt | ||
$ | ||
$ # Set the FLASK_APP environment variable | ||
$ (Unix/Mac) export FLASK_APP=run.py | ||
$ (Windows) set FLASK_APP=run.py | ||
$ (Powershell) $env:FLASK_APP = ".\run.py" | ||
$ | ||
$ # Set up the DEBUG environment | ||
$ # (Unix/Mac) export FLASK_ENV=development | ||
$ # (Windows) set FLASK_ENV=development | ||
$ # (Powershell) $env:FLASK_ENV = "development" | ||
$ | ||
$ # Run the application | ||
$ # --host=0.0.0.0 - expose the app on all network interfaces (default 127.0.0.1) | ||
$ # --port=5000 - specify the app port (default 5000) | ||
$ flask run --host=0.0.0.0 --port=5000 | ||
$ | ||
$ # Access the app in browser: http://127.0.0.1:5000/ | ||
``` | ||
|
||
> Note: To use the app, please access the registration page and create a new user. After authentication, the app will unlock the private pages. | ||
<br /> | ||
|
||
## Code-base structure | ||
|
||
The project has a super simple structure, represented as bellow: | ||
|
||
```bash | ||
< PROJECT ROOT > | ||
| | ||
|-- app/__init__.py | ||
|-- app/ | ||
| |-- static/ | ||
| | |-- <css, JS, images> # CSS files, Javascripts files | ||
| | | ||
| |-- templates/ | ||
| | | | ||
| | |-- includes/ # Page chunks, components | ||
| | | | | ||
| | | |-- navigation.html # Top bar | ||
| | | |-- sidebar.html # Left sidebar | ||
| | | |-- scripts.html # JS scripts common to all pages | ||
| | | |-- footer.html # The common footer | ||
| | | | ||
| | |-- layouts/ # App Layouts (the master pages) | ||
| | | | | ||
| | | |-- base.html # Used by common pages like index, UI | ||
| | | |-- base-fullscreen.html # Used by auth pages (login, register) | ||
| | | | ||
| | |-- accounts/ # Auth Pages (login, register) | ||
| | | | | ||
| | | |-- login.html # Use layout `base-fullscreen.html` | ||
| | | |-- register.html # Use layout `base-fullscreen.html` | ||
| | | | ||
| | index.html # The default page | ||
| | page-404.html # Error 404 page (page not found) | ||
| | page-500.html # Error 500 page (server error) | ||
| | *.html # All other pages provided by the UI Kit | ||
| | ||
|-- requirements.txt | ||
| | ||
|-- run.py | ||
| | ||
|-- ************************************************************************ | ||
``` | ||
|
||
<br /> | ||
|
||
## Deployment | ||
|
||
The app is provided with a basic configuration to be executed in [Docker](https://www.docker.com/), [Gunicorn](https://gunicorn.org/), and [Waitress](https://docs.pylonsproject.org/projects/waitress/en/stable/). | ||
|
||
<br /> | ||
|
||
### [Docker](https://www.docker.com/) execution | ||
--- | ||
|
||
The application can be easily executed in a docker container. The steps: | ||
|
||
> Get the code | ||
```bash | ||
$ git clone https://github.com/app-generator/boilerplate-code-flask.git | ||
$ cd boilerplate-code-flask | ||
``` | ||
|
||
> Start the app in Docker | ||
```bash | ||
$ sudo docker-compose pull && sudo docker-compose build && sudo docker-compose up -d | ||
``` | ||
|
||
Visit `http://localhost:5005` in your browser. The app should be up & running. | ||
|
||
<br /> | ||
|
||
### [Gunicorn](https://gunicorn.org/) | ||
--- | ||
|
||
Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. | ||
|
||
> Install using pip | ||
```bash | ||
$ pip install gunicorn | ||
``` | ||
> Start the app using gunicorn binary | ||
```bash | ||
$ gunicorn --bind 0.0.0.0:8001 run:app | ||
Serving on http://localhost:8001 | ||
``` | ||
|
||
Visit `http://localhost:8001` in your browser. The app should be up & running. | ||
|
||
<br /> | ||
|
||
### [Waitress](https://docs.pylonsproject.org/projects/waitress/en/stable/) | ||
--- | ||
|
||
Waitress (Gunicorn equivalent for Windows) is meant to be a production-quality pure-Python WSGI server with very acceptable performance. It has no dependencies except ones that live in the Python standard library. | ||
|
||
> Install using pip | ||
```bash | ||
$ pip install waitress | ||
``` | ||
> Start the app using [waitress-serve](https://docs.pylonsproject.org/projects/waitress/en/stable/runner.html) | ||
```bash | ||
$ waitress-serve --port=8001 run:app | ||
Serving on http://localhost:8001 | ||
``` | ||
|
||
Visit `http://localhost:8001` in your browser. The app should be up & running. | ||
|
||
<br /> | ||
|
||
## Credits & Links | ||
|
||
- [Flask Framework](https://www.palletsprojects.com/p/flask/) - The official website | ||
- [Boilerplate Code](https://appseed.us/boilerplate-code) - Index provided by **AppSeed** | ||
- [Boilerplate Code](https://github.com/app-generator/boilerplate-code) - Index published on Github | ||
|
||
<br /> | ||
|
||
--- | ||
[Boierplate Code Flask](https://appseed.us/boilerplate-code/flask) - Provided by **AppSeed** [Web App Generator](https://appseed.us/app-generator). |
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 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
import os | ||
|
||
from flask import Flask | ||
from flask_sqlalchemy import SQLAlchemy | ||
from flask_login import LoginManager | ||
from flask_bcrypt import Bcrypt | ||
|
||
# Grabs the folder where the script runs. | ||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
app = Flask(__name__) | ||
|
||
app.config.from_object('app.config.Config') | ||
|
||
db = SQLAlchemy (app) # flask-sqlalchemy | ||
bc = Bcrypt (app) # flask-bcrypt | ||
|
||
lm = LoginManager( ) # flask-loginmanager | ||
lm.init_app(app) # init the login manager | ||
|
||
# Setup database | ||
@app.before_first_request | ||
def initialize_database(): | ||
db.create_all() | ||
|
||
# Import routing, models and Start the App | ||
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,21 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
import os | ||
from decouple import config | ||
|
||
# Grabs the folder where the script runs. | ||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
class Config(): | ||
|
||
CSRF_ENABLED = True | ||
|
||
# Set up the App SECRET_KEY | ||
SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_007') | ||
|
||
# This will create a file in <app> FOLDER | ||
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3') | ||
SQLALCHEMY_TRACK_MODIFICATIONS = 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,19 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Copyright (c) 2019 - present AppSeed.us | ||
""" | ||
|
||
from flask_wtf import FlaskForm | ||
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): | ||
name = StringField (u'Name' ) | ||
username = StringField (u'Username' , validators=[DataRequired()]) | ||
password = PasswordField(u'Password' , validators=[DataRequired()]) | ||
email = StringField (u'Email' , validators=[DataRequired(), Email()]) |
Oops, something went wrong.