shopcube icon indicating copy to clipboard operation
shopcube copied to clipboard

Bug: setting .flaskenv raises ModuleNotFoundError: No module named 'modules'

Open rehmanis opened this issue 3 years ago • 2 comments

setting FLASK_APP and FLASK_ENV as below in .flaskenv or uncommenting these line https://github.com/Abdur-rahmaanJ/shopyo/blob/dev/shopyo/api/cli.py#L44-L46 cause ModuleNotFoundError: No module named 'modules' at line https://github.com/Abdur-rahmaanJ/shopyo/blob/dev/shopyo/app.py#L19 when running shopyo initilaise. If I change the import to from shopyo.modules.box__default.settings.helpers import get_setting then I get the Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.

#.flaskenv
FLASK_APP = "app:create_app('development')"
FLASK_ENV = "development"

For now the only way to fix this will break the new command (i.e. we will need to add from shopyo.app import create_app, from shopyo.init import db, etc

rehmanis avatar Apr 18 '21 07:04 rehmanis

@rehmanis i am for not locking db in api. People must be free to choose their ORM

Abdur-rahmaanJ avatar Apr 27 '21 01:04 Abdur-rahmaanJ

@Abdur-rahmaanJ not sure how that is related to the bug. Maybe I am missing your point. Basically we can fix the bug easily by fixing our imports by specifying shopyo.modules. etc but this breaks shopyo new command (or you will have to make strings for every file like we currently do for some files) because the user will have something else i.e foo.modules

rehmanis avatar Apr 27 '21 03:04 rehmanis