[REF-2561] Shouldn't rx.Config.app_name be the module/app path?
picklelo opened this issue · comments
Discussed in https://github.com/orgs/reflex-dev/discussions/3063
Originally posted by rodrigosetti April 10, 2024
I'm organizing a larger reflex project and wanted to place my reflex app in a subpackage, but rx.Config(app_name="X")
constrains the application to be X.X
(reflex.config.py) - which is a weird behavior if X
is a general module path.
It would be nice if we change this behavior to what Flask does (without the defaults). quoting from Flask's documentation:
--app
has three parts: an optional path that sets the current working directory, a Python file or dotted import path, and an optional variable name of the instance or factory. If the name is a factory, it can optionally be followed by arguments in parentheses. The following values demonstrate these parts:
--app src/hello
Sets the current working directory to src then imports hello.
--app hello.web
Imports the path hello.web.
--app hello:app2
Uses the app2 Flask instance in hello.
--app 'hello:create_app("dev")'
The create_app factory in hello is called with the string 'dev' as the argument.
This proposal is backwards incompatible, so it will need a new parameter (app
?) and app_name
deprecation.
NOTE: I'm just joining the community, so please excuse if this was already discussed or I'm overlooking something major.