You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For historical reasons, the app repos are named WAM_APP_<NAME> which is now the (implicit) naming convention. At least in the v0.1 release's .gitignore file those dirs are excluded from version control to prevent accidental adding of app files. Contrary, the current docs say you must rename the app dir.
I'd like to discuss implications of this convention, find a consistent way to name and structure apps and derive a guideline for app developers.
Requirements of status quo:
Apps are located in the WAM root dir: <WAM_ROOT>/<APP_NAME>/
Directory <APP_NAME> is treated as package hence needs an __init__.py file =>
<APP_NAME> = <PACKAGE_NAME> = <NAME_IN_WAM_APPS>
Structure in app dir must follow the WAM's requirements as configuration is read from them:
files you must have located in your app dir: urls.py (imported here)
files you can use to config you app: settings.py (e.g. to add additional INSTALLED_APPS, imported here), app_settings.py (imported here and here)
As a straightforward solution for WAM_APP_stemp_abw I tried to keep the Repo name, change the name in env WAM_APPS accordingly and add an init file with
import WAM_APP_stemp_abw as stemp_abw
to keep my custom app name. This and other attempts didn't work out as Python always uses the dir name as package name (ref) (any hints welcome).
So currently it seems to be impossible to use a custom package structure or app name - only with renaming dir since it has to match the app package name.
I see two options here:
Keep it as it is -> implications:
rename all existing apps which do not match the naming convention
to create a distributable app you would have to keep a second folder structure for your app with (example tutorial).
bulky import statements like from WAM_APP_my_super_package.XXX.YYY import ZZZ
WAM "branding" of packages (ugly)
Does this option really suit the future needs?
2. Refactor app structure (see below)
New requirements:
App directories in WAM are named WAM_APP_<NAME>
Allow apps to use a custom name different from WAM_APP_<NAME>. This allows for module imports à la from myapp.XXX import YYY.
It could be achieved using a (in python quite common package) structure like
using a variable APP_NAME = 'myapp' in WAM_APP_myapp/__init__.py which is used by WAM core to properly load urls.py etc. from package.
3. Allow developers to create a package from their app (should work with the above structure).
For the 2nd options, there'd be some tasks around the corner @henhuy.. ;)
Opinions, hints, amendments?
The text was updated successfully, but these errors were encountered:
Hey @rl-institut/wam-team, we need to talk ;).
For historical reasons, the app repos are named
WAM_APP_<NAME>
which is now the (implicit) naming convention. At least in the v0.1 release's .gitignore file those dirs are excluded from version control to prevent accidental adding of app files. Contrary, the current docs say you must rename the app dir.I'd like to discuss implications of this convention, find a consistent way to name and structure apps and derive a guideline for app developers.
Requirements of status quo:
__init__.py
file =><APP_NAME> = <PACKAGE_NAME> = <NAME_IN_WAM_APPS>
urls.py
(imported here)settings.py
(e.g. to add additionalINSTALLED_APPS
, imported here),app_settings.py
(imported here and here)As a straightforward solution for WAM_APP_stemp_abw I tried to keep the Repo name, change the name in env
WAM_APPS
accordingly and add an init file withto keep my custom app name. This and other attempts didn't work out as Python always uses the dir name as package name (ref) (any hints welcome).
So currently it seems to be impossible to use a custom package structure or app name - only with renaming dir since it has to match the app package name.
I see two options here:
from WAM_APP_my_super_package.XXX.YYY import ZZZ
Does this option really suit the future needs?
2. Refactor app structure (see below)
New requirements:
WAM_APP_<NAME>
WAM_APP_<NAME>
. This allows for module imports à lafrom myapp.XXX import YYY
.It could be achieved using a (in python quite common package) structure like
using a variable
APP_NAME = 'myapp'
inWAM_APP_myapp/__init__.py
which is used by WAM core to properly loadurls.py
etc. from package.3. Allow developers to create a package from their app (should work with the above structure).
For the 2nd options, there'd be some tasks around the corner @henhuy.. ;)
Opinions, hints, amendments?
The text was updated successfully, but these errors were encountered: