corydolphin / flask-cors

Cross Origin Resource Sharing ( CORS ) support for Flask
https://flask-cors.corydolphin.com/
MIT License
877 stars 137 forks source link

No CORS when starting the app through entry_points #244

Open alensiljak opened 5 years ago

alensiljak commented 5 years ago

Hi, I have a weird issue. Using Flask-CORS as documented works if the Flask app is started with flask run. Since I want to have the app ready on other devices, I've added an entry in entry_points in setup.py so that

    entry_points={
        'console_scripts': [
            'cashiersync=cashiersync.app:run_server',
        ],
    },

This allows me to run the web app by running cashiersync from the console. It does indeed start but the CORS headers are not present! If, instead, I do

export FLASK_APP=cashiersync.app
flask run

on the client machine, the headers are present again. The rest of the code is identical.

I'm a bit puzzled about this behaviour. Could you provide any ideas? I'd like to be able to have a console script for starting the server come packaged in pip package, if possible. The package is called cashiersync and is available on PyPi.

The source code for the project is available at https://gitlab.com/alensiljak/cashier-sync. The app is extremely small so it is not difficult to see what is going on. Thanks!