I'm trying create custom flask extension and use it within my application. I'm using below project structure.
ExapmpleProject
--> apps
--> extensions
-->flask-customext
-->__init__.py
-->flask_customext.py
-->setup.py
--> sample.py
sample.py
from flask import Flask
from flask.ext import customext
app = Flask(__name__)
@app.route('/')
def hello_world():
if customext.validate():
return 'Hello World!'
else:
return 'not allowed!'
if __name__ == '__main__':
app.run()
I followed standard class based extension within flask-customext
package as defined in the extention dev doc. How can I install this customext
to be imported by from flask.ext import customext
used in sample.py
as any other flask-extensions does.
Not sure if this do the job but I tried python setup.py install
. but it raised below error
error: package directory 'flask_customext' does not exist