From charlesreid1

Revision as of 16:32, 5 July 2014 by Admin (talk | contribs) (Created page with "To embed a Flask app inside a module: <pre> /yourlibrary /yourlibrary __init__.py some_code.py [...] /webapp __init__.py templates/ index.html ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To embed a Flask app inside a module:

/yourlibrary
  /yourlibrary
    __init__.py
    some_code.py
    [...]
  /webapp
    __init__.py
    templates/
      index.html
      [...]

Then you will structure your setup.py like this:

config = {
    'description': 'foo',
    'author': 'bar',
    'version': '1.0',
    'install_requires': ['flask'],
    'packages': ['yourlibrary','webapp'],
    'include_package_data' : True,
    'scripts': [],
    'name': 'yourlibarary',
    'zip_safe' : False
}

setup(**config)

The include package data directive points setup.py to a manifest file called MAFIEST.in, which sits next to setup.py. That should have these lines:

recursive-include yourapplication/templates *
recursive-include yourapplication/static *