Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 2 KB

README.md

File metadata and controls

72 lines (49 loc) · 2 KB

flaskcode

Build Status PyPI Version

Web based code editor for flask

Code editor with python Flask framework backend.

screenshot

Installation

$ pip install flaskcode

Running the application

Run the application standalone, like this:

$ flaskcode /path/to/resource/folder
FlaskCode CLI: /path/to/resource/folder
...
$ flaskcode --help
Usage: flaskcode [OPTIONS] [RESOURCE_BASEPATH]

  Run FlaskCode with given RESOURCE_BASEPATH or current working directory.

  All options can be set on the command line or through environment
  variables of the form FLASKCODE_*. For example FLASKCODE_USERNAME.

Options:
  -h, --host TEXT     IP or hostname on which to run HTTP server.
  -p, --port INTEGER  Port on which to bind HTTP server.
  --username TEXT     HTTP Basic Auth username.
  --password TEXT     HTTP Basic Auth password.
  --debug             Enter DEBUG mode.
  --env TEXT          Flask environment, default is development.
  --version           Show the version and exit.
  --help              Show this message and exit.

Integrating flaskcode in your Flask app

The flaskcode can be integrated in to your own Flask app by accessing the blueprint directly in the normal way, e.g.:

from flask import Flask
import flaskcode

app = Flask(__name__)
app.config.from_object(flaskcode.default_config)
app.config['FLASKCODE_RESOURCE_BASEPATH'] = '/path/to/resource/folder'
app.register_blueprint(flaskcode.blueprint, url_prefix='/flaskcode')

@app.route('/')
def hello():
    return "Hello World!"

if __name__ == '__main__':
    app.run()

Now if you run the Flask app on default port, you can access the flaskcode at http://127.0.0.1:5000/flaskcode.