Sign inSign up

daspanel/panel

By daspanel

•Updated about 9 years ago

Web frontend for DASPANEL

Image
0

961

daspanel/panel repository overview

⁠Flask Seed App

Docker Hub Requirements Status devDependency Status

This app is meant to serve as template for new projects. It has the following features:

  • User accounts implemented with SQLite, cookies and Flask-Login
  • Passwords hashed with bcrypt
  • CSRF protection with Flask-CSRF
  • Email with Flask-Mail
  • Login/logout/forgot password workflow
  • Static asset build step with gulp
  • Basic HTML Web and Email templates with MUI (https://www.muicss.com⁠)
  • Unittests

To create a new app from flaskapp first clone the repository and remove the .git directory:

$ git clone [email protected]:muicss/flaskapp.git
$ rm -rf flaskapp/.git

Then, do a search-replace on the string flaskapp (remember to replace <name> with your app's name):

$ find flaskapp -type f | xargs sed -i'' -e 's/flaskapp/<name>/g'
$ find flaskapp -type f | xargs sed -i'' -e 's/Flaskapp/<Name>/g'
$ mv flaskapp <name>
$ mv <name>/flaskapp <name>/<name>

Now you have your own flask seed project.

⁠Config Variables

flaskapp can be configured using the following environment variables:

NameDescriptionDefaultRequired
DEBUGFlask debug variable"False"no
SECRET_KEYFlask cookie encryption keynullyes
MAIL_PORTSMTP portnullyes
MAIL_SERVERSMTP hostnamenullyes
MAIL_USERNAMESMTP usernamenullyes
MAIL_PASSWORDSMTP passwordnullyes

⁠Quickstart

To work in a sandboxed Python environment we recommend installing the app in a Python virtualenv⁠.

  1. Install dependencies

    $ cd /path/to/flaskapp
    $ pip install -r requirements.txt
    
  2. Setup a SQLite database for development (app.db)

    $ python scripts/create_db.py
    
  3. Environment variables

    In order to configure flaskapp it is recommended that you create an environment file with the required variables listed above:

    #!/bin/bash
    # Environment variables for Flask seed app
    
    export DEBUG="True"
    export SECRET_KEY="replaceme"
    export MAIL_PORT="587"
    export MAIL_SERVER="mail.google.com"
    export MAIL_USERNAME="[email protected]"
    export MAIL_PASSWORD="replaceme"
    

    To add the variables to your environment you can source the file as part of your normal workflow:

    $ source /path/to/env-vars.sh
    
  4. Run development server

    $ python wsgi.py
    

    View at http://127.0.0.1:5000⁠

  5. Frontend build scripts

    Install node dependencies:

    $ cd /path/to/flaskapp/static-src
    $ npm install
    

    Run gulp:

    $ ./node_modules/.bin/gulp build
    

⁠Unittests

To run all tests:

$ nosetests

To run an individual test:

$ nosetests tests/views/test_content.py

⁠Contribute

Contributions are welcome! If you'd like to report an issue or submit a pull request please use our github page: https://github.com/muicss/flaskapp⁠.

Tag summary

Content type

Image

Digest

Size

61.4 MB

Last updated

about 9 years ago

docker pull daspanel/panel