ruiaylin / Flask-select2

example of select2 and wtf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask Tagging Test

Sample implementation of Select2 with tagging in Flask and WTForms.

This is a demo app, which saves tags and tag mappings to the session data store. So, for every new browser session, the tag data starts out empty. Obviously, in a real-life app, tags would be saved to database models (e.g. using SQLAlchemy), or to some other persistent data store, instead.

Here's a demo of the app in action.

Quickstart

First, set your app's secret key as an environment variable. For example, example add the following to .bashrc or .bash_profile.

export FLASKTAGGINGTEST_SECRET='something-really-secret'

Then run the following commands to bootstrap your environment.

git clone https://github.com/Jaza/flasktaggingtest
cd flasktaggingtest
pip install -r requirements/dev.txt
python manage.py server

You will see a pretty welcome screen.

Run the following to initialize your app:

python manage.py server

Dynamic Secret Key

You can have a different random secret key each time the app starts, if you want:

export FLASKTAGGINGTEST_SECRET=`python -c "import os; from binascii import hexlify; print(hexlify(os.urandom(24)))"`; python manage.py server

Deployment

In your production environment, make sure the FLASKTAGGINGTEST_ENV environment variable is set to "prod".

Shell

To open the interactive shell, run

python manage.py shell

By default, you will have access to app.

Running Tests

To run all tests, run

python manage.py test

About

example of select2 and wtf

License:Apache License 2.0


Languages

Language:JavaScript 89.5%Language:CSS 5.1%Language:Python 4.0%Language:HTML 1.4%