Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Extensions of Flask

Project description

Flask-Ext

Some extensions of Flask.

Subdomain

  • Configure app attributes
app.static_url_path = '/static'
app.static_folder = 'static'
app.add_url_rule(app.static_url_path + '/<path:filename>',
                 endpoint='static',
                 view_func=app.send_static_file)
  • Configure settings.py
SERVER_NAME = 'project_name.test:5000'
SESSION_COOKIE_DOMAIN = "." + SERVER_NAME
  • Configure views.py
blueprint = Blueprint('portal', __name__, subdomain='<subdomain>')
add_subdomain_support(blueprint)
  • Configure RequireJS and Layer
<script>
    requirejs.config({
        baseUrl: '{{ '%s%s' | format('http://', config.SERVER_NAME) }}'
    });
</script>
<script>
    require(['layer'], function(layer){
        layer.config({
            path: "{{ '%s%s%s' | format('http://', config.SERVER_NAME, '/static/plugins/layer-3.1.1/') }}"
        });
    });
</script>
  • Notice: You can use g.subdomain to get current subdomain.

Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Flask-Ext, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size Flask_Ext-0.1-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Flask-Ext-0.1.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page