Code Monkey home page Code Monkey logo

Comments (8)

chfw avatar chfw commented on May 26, 2024 1

Simply move line 5 outside, would make it work in both scenarios.

from project import app
import flask_excel as excel

excel.init_excel(app)

if __name__ == '__main__':    
    app.run(debug=False, use_debugger=False, host='127.0.0.1')

As to the best place, you may consider application factory: https://flask.palletsprojects.com/en/1.1.x/tutorial/factory/ . I would imagine, you will have other configurations before the app runs.

from flask-excel.

chfw avatar chfw commented on May 26, 2024

it needs this initialisation function:

https://github.com/pyexcel-webwares/Flask-Excel/blob/master/flask_excel/__init__.py#L68

from flask-excel.

Jrokisky avatar Jrokisky commented on May 26, 2024

Hi @chfw,

I was running the initialization function in my main call as follows:

if __name__ == '__main__':
    excel.init_excel(app)
    app.run(debug=False, use_debugger=False, host='127.0.0.1')

from flask-excel.

chfw avatar chfw commented on May 26, 2024

here is an example using raw pyexcel instead of Flask-Excel nor custom implementation: http://docs.pyexcel.org/en/latest/webdev.html

from flask-excel.

Jrokisky avatar Jrokisky commented on May 26, 2024

@chfw Thank you!

from flask-excel.

chfw avatar chfw commented on May 26, 2024
if __name__ == '__main__':
    excel.init_excel(app)
    app.run(debug=False, use_debugger=False, host='127.0.0.1')

above is what you run as standalone server.

for your uwsgi app, what's your entry point?

I suspect 'None' came from this dummy function: https://github.com/pyexcel-webwares/pyexcel-webio/blob/master/pyexcel_webio/__init__.py#L307

So I think the initialization code were not present in your uwsgi app entry code.

from flask-excel.

Jrokisky avatar Jrokisky commented on May 26, 2024

uWSGI ini:

[uwsgi]
wsgi-file = run.py
callable = app

run.py:

from project import app
import flask_excel as excel

if __name__ == '__main__':
    excel.init_excel(app)
    app.run(debug=False, use_debugger=False, host='127.0.0.1')

The app item is created in project's init.

So I think the initialization code were not present in your uwsgi app entry code.

This sounds like the issue. Any recommendation for the best place to initialize?

from flask-excel.

Jrokisky avatar Jrokisky commented on May 26, 2024

@chfw Thank you!

from flask-excel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.