-
Notifications
You must be signed in to change notification settings - Fork 63
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 12, 2021
1 parent
c3217e4
commit 2f94b9c
Showing
2,051 changed files
with
74,744 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,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 < *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 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,238 @@ | ||
# [Flask](https://appseed.us/boilerplate-code/flask-boilerplate) Pixel Lite | ||
|
||
Open-Source **Flask** starter coded with basic modules, database, ORM and deployment scripts on top of **Pixel Lite** UI Kit, a fully responsive and modern Bootstrap 4 UI Kit that will help you build creative and professional websites. | ||
|
||
<br /> | ||
|
||
> Flask Dashboard Features | ||
- UI Kit: **Pixel Lite** (Free Version) by **Themesberg** | ||
- SQLite database, Flask-SQLAlchemy ORM | ||
- Session-Based auth flow (login, register) | ||
- Deployment scripts: Docker, Gunicorn / Nginx, Heroku | ||
- Support via **Github** (issues tracker) and [Discord](https://discord.gg/fZC6hup). | ||
|
||
<br /> | ||
|
||
> Links | ||
- [Flask Pixel Lite](https://appseed.us/apps/flask-apps/flask-pixel-bootstrap-uikit) - product page | ||
- [Flask Pixel Lite - Demo](https://flask-pixel-lite.appseed-srv1.com/) - LIVE Deployment | ||
|
||
<br /> | ||
|
||
## Want more? Go PRO! | ||
|
||
PRO versions include **Premium UI Kits**, Lifetime updates and **24/7 LIVE Support** (via [Discord](https://discord.gg/fZC6hup)) | ||
|
||
| [Flask Datta PRO](https://appseed.us/admin-dashboards/flask-dashboard-dattaable-pro) | [Flask Material PRO](https://appseed.us/admin-dashboards/flask-dashboard-material-pro) | [Flask Volt PRO](https://appseed.us/admin-dashboards/flask-dashboard-volt-pro) | | ||
| --- | --- | --- | | ||
| [![Flask Datta PRO](https://raw.githubusercontent.com/app-generator/flask-dashboard-dattaable-pro/master/media/flask-dashboard-dattaable-pro-screen.png)](https://appseed.us/admin-dashboards/flask-dashboard-dattaable-pro) | [![Flask Material PRO](https://raw.githubusercontent.com/app-generator/flask-dashboard-material-pro/master/media/flask-dashboard-material-pro-screen.png)](https://appseed.us/admin-dashboards/flask-dashboard-material-pro) | [![Flask Volt PRO](https://raw.githubusercontent.com/app-generator/flask-dashboard-volt-pro/master/media/flask-dashboard-volt-pro-screen.png)](https://appseed.us/admin-dashboards/flask-dashboard-volt-pro) | ||
|
||
<br /> | ||
<br /> | ||
|
||
![Flask Pixel Lite - Open-Source web app coded in Flask.](https://raw.githubusercontent.com/app-generator/flask-pixel-bootstrap-uikit/master/media/flask-pixel-bootstrap-uikit-screen.png) | ||
|
||
<br /> | ||
|
||
## Build from sources | ||
|
||
```bash | ||
$ # Clone the sources | ||
$ git clone https://github.com/app-generator/flask-pixel-bootstrap-uikit.git | ||
$ cd flask-pixel-bootstrap-uikit | ||
$ | ||
$ # 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/), [Heroku](https://www.heroku.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/flask-pixel-bootstrap-uikit.git | ||
$ cd flask-pixel-bootstrap-uikit | ||
``` | ||
|
||
> 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 /> | ||
|
||
### [Heroku](https://www.heroku.com/) | ||
--- | ||
|
||
Steps to deploy on **Heroku** | ||
|
||
- [Create a FREE account](https://signup.heroku.com/) on Heroku platform | ||
- [Install the Heroku CLI](https://devcenter.heroku.com/articles/getting-started-with-python#set-up) that match your OS: Mac, Unix or Windows | ||
- Open a terminal window and authenticate via `heroku login` command | ||
- Clone the sources and push the project for LIVE deployment | ||
|
||
```bash | ||
$ # Clone the source code: | ||
$ git clone https://github.com/app-generator/flask-pixel-bootstrap-uikit.git | ||
$ cd flask-pixel-bootstrap-uikit | ||
$ | ||
$ # Check Heroku CLI is installed | ||
$ heroku -v | ||
heroku/7.25.0 win32-x64 node-v12.13.0 # <-- All good | ||
$ | ||
$ # Check Heroku CLI is installed | ||
$ heroku login | ||
$ # this commaond will open a browser window - click the login button (in browser) | ||
$ | ||
$ # Create the Heroku project | ||
$ heroku create | ||
$ | ||
$ # Trigger the LIVE deploy | ||
$ git push heroku master | ||
$ | ||
$ # Open the LIVE app in browser | ||
$ heroku open | ||
``` | ||
|
||
<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 /> | ||
|
||
--- | ||
[Flask](https://appseed.us/boilerplate-code/flask-boilerplate) Pixel Lite - Provided by **AppSeed** [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.