项目作者: app-generator

项目描述 :
Flask Dashboard - Star Admin PRO Design | AppSeed
高级语言:
项目地址: git://github.com/app-generator/flask-star-admin-pro.git
创建时间: 2020-04-05T06:52:08Z
项目社区:https://github.com/app-generator/flask-star-admin-pro

开源协议:Other

下载


Flask Star Admin PRO

Admin dashboard generated by AppSeed in Flask Framework. Designed based on the Bootstrap framework, Star Admin PRO is a powerful, feature-rich, and super flexible admin dashboard template. It serves as the perfect starting point for both simple and complex web development projects. It features a well-designed dashboard with several neatly arranged components and essential elements.


Features

  • Up-to-date dependencies: Flask 2.0.1
  • SCSS compilation via Gulp
  • DBMS: SQLite, PostgreSQL (production)
  • DB Tools: SQLAlchemy ORM, Flask-Migrate (schema migrations)
  • Modular design with Blueprints, simple codebase
  • Session-Based authentication (via flask_login), Forms validation
  • Deployment scripts: Docker, Gunicorn / Nginx, Heroku
  • Support via Github and Discord.


Links


Quick Start in Docker

Get the code

  1. $ git clone https://github.com/app-generator/priv-flask-star-admin-pro.git
  2. $ cd priv-flask-star-admin-pro

Start the app in Docker

  1. $ docker-compose pull # download dependencies
  2. $ docker-compose build # local set up
  3. $ docker-compose up -d # start the app

Visit http://localhost:85 in your browser. The app should be up & running.


Flask Star Admin PRO - Open-Source template project provided by AppSeed.


How to use it

  1. $ # Get the code
  2. $ git clone https://github.com/app-generator/priv-flask-star-admin-pro.git
  3. $ cd priv-flask-star-admin-pro
  4. $
  5. $ # Virtualenv modules installation (Unix based systems)
  6. $ virtualenv env
  7. $ source env/bin/activate
  8. $
  9. $ # Virtualenv modules installation (Windows based systems)
  10. $ # virtualenv env
  11. $ # .\env\Scripts\activate
  12. $
  13. $ # Install modules - SQLite Database
  14. $ pip3 install -r requirements.txt
  15. $
  16. $ # OR with PostgreSQL connector
  17. $ # pip install -r requirements-pgsql.txt
  18. $
  19. $ # Set the FLASK_APP environment variable
  20. $ (Unix/Mac) export FLASK_APP=run.py
  21. $ (Windows) set FLASK_APP=run.py
  22. $ (Powershell) $env:FLASK_APP = ".\run.py"
  23. $
  24. $ # Set up the DEBUG environment
  25. $ # (Unix/Mac) export FLASK_ENV=development
  26. $ # (Windows) set FLASK_ENV=development
  27. $ # (Powershell) $env:FLASK_ENV = "development"
  28. $
  29. $ # Start the application (development mode)
  30. $ # --host=0.0.0.0 - expose the app on all network interfaces (default 127.0.0.1)
  31. $ # --port=5000 - specify the app port (default 5000)
  32. $ flask run --host=0.0.0.0 --port=5000
  33. $
  34. $ # Access the dashboard 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.


Code-base structure

The project is coded using blueprints, app factory pattern, dual configuration profile (development and production), and an intuitive structure presented below:

  1. < PROJECT ROOT >
  2. |
  3. |-- apps/
  4. | |
  5. | |-- home/ # A simple app that serve HTML files
  6. | | |-- routes.py # Define app routes
  7. | |
  8. | |-- authentication/ # Handles auth routes (login and register)
  9. | | |-- routes.py # Define authentication routes
  10. | | |-- models.py # Defines models
  11. | | |-- forms.py # Define auth forms (login and register)
  12. | |
  13. | |-- static/
  14. | | |-- <css, JS, images> # CSS files, Javascripts files
  15. | |
  16. | |-- templates/ # Templates used to render pages
  17. | | |-- includes/ # HTML chunks and components
  18. | | | |-- navigation.html # Top menu component
  19. | | | |-- sidebar.html # Sidebar component
  20. | | | |-- footer.html # App Footer
  21. | | | |-- scripts.html # Scripts common to all pages
  22. | | |
  23. | | |-- layouts/ # Master pages
  24. | | | |-- base-fullscreen.html # Used by Authentication pages
  25. | | | |-- base.html # Used by common pages
  26. | | |
  27. | | |-- accounts/ # Authentication pages
  28. | | | |-- login.html # Login page
  29. | | | |-- register.html # Register page
  30. | | |
  31. | | |-- home/ # UI Kit Pages
  32. | | |-- index.html # Index page
  33. | | |-- 404-page.html # 404 page
  34. | | |-- *.html # All other pages
  35. | |
  36. | config.py # Set up the app
  37. | __init__.py # Initialize the app
  38. |
  39. |-- requirements.txt # Development modules - SQLite storage
  40. |-- requirements-mysql.txt # Production modules - Mysql DMBS
  41. |-- requirements-pqsql.txt # Production modules - PostgreSql DMBS
  42. |
  43. |-- Dockerfile # Deployment
  44. |-- docker-compose.yml # Deployment
  45. |-- gunicorn-cfg.py # Deployment
  46. |-- nginx # Deployment
  47. | |-- appseed-app.conf # Deployment
  48. |
  49. |-- .env # Inject Configuration via Environment
  50. |-- run.py # Start the app - WSGI gateway
  51. |
  52. |-- ************************************************************************


Recompile CSS

To recompile SCSS files, follow this setup:


Step #1 - Install tools

  • NodeJS 12.x or higher
  • Gulp - globally
    • npm install -g gulp-cli
  • Yarn (optional)


Step #2 - Change the working directory to assets folder

  1. $ cd apps/static/assets


Step #3 - Install modules (this will create a classic node_modules directory)

  1. $ npm install
  2. // OR
  3. $ yarn


Step #4 - Edit & Recompile SCSS files

  1. $ gulp scss

The generated file is saved in static/assets/css directory.


Deployment

The app is provided with a basic configuration to be executed in Docker, Heroku, Gunicorn, and Waitress.

Heroku


Steps to deploy on Heroku

  • Create a FREE account on Heroku platform
  • Install the Heroku CLI 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
  1. $ # Clone the source code:
  2. $ git clone https://github.com/app-generator/priv-flask-star-admin-pro.git
  3. $ cd priv-flask-star-admin-pro
  4. $
  5. $ # Check Heroku CLI is installed
  6. $ heroku -v
  7. heroku/7.25.0 win32-x64 node-v12.13.0 # <-- All good
  8. $
  9. $ # Check Heroku CLI is installed
  10. $ heroku login
  11. $ # this commaond will open a browser window - click the login button (in browser)
  12. $
  13. $ # Create the Heroku project
  14. $ heroku create
  15. $
  16. $ # Trigger the LIVE deploy
  17. $ git push heroku master
  18. $
  19. $ # Open the LIVE app in browser
  20. $ heroku open


Gunicorn


Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP Server for UNIX.

Install using pip

  1. $ pip install gunicorn

Start the app using gunicorn binary

  1. $ gunicorn --bind 0.0.0.0:8001 run:app
  2. Serving on http://localhost:8001

Visit http://localhost:8001 in your browser. The app should be up & running.


Waitress


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

  1. $ pip install waitress

Start the app using waitress-serve

  1. $ waitress-serve --port=8001 run:app
  2. Serving on http://localhost:8001

Visit http://localhost:8001 in your browser. The app should be up & running.




Flask Star Admin PRO - Provided by AppSeed App Generator.