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
I see the following warning when starting the development server with tethys manage start with Django 5:
RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
This probably has to do with the app harvesting routines that get called on startup. It doesn't seem to be causing actual issues though, so I recommend we suppress the warning somehow.
To Reproduce
Install latest dev version of Tethys with Django 5
Run tethys manage start
Expected behavior
No ugly warnings.
Errors/Traceback
Loading Tethys Extensions...
Loading Tethys Apps...
/home/firehawk/miniconda3/envs/mtethys/lib/python3.12/site-packages/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
Tethys Apps Loaded: dam_inventory
Performing system checks...
System check identified no issues (0 silenced).
June 20, 2024 - 03:31:49
Django version 5.0.6, using settings 'tethys_portal.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Screenshots
N/A
Tethys Environment Information
Include output from these commands:
tethys version
4.2.0.post3.dev38+g59a80e44.d20240620
conda info
active environment : mtethys
active env location : /home/firehawk/miniconda3/envs/mtethys
shell level : 2
user config file : /home/firehawk/.condarc
populated config files :
conda version : 24.5.0
conda-build version : not installed
python version : 3.12.3.final.0
solver : libmamba (default)
virtual packages : __archspec=1=broadwell
__conda=24.5.0=0
__glibc=2.35=0
__linux=6.5.0=0
__unix=0=0
base environment : /home/firehawk/miniconda3 (writable)
conda av data dir : /home/firehawk/miniconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/firehawk/miniconda3/pkgs
/home/firehawk/.conda/pkgs
envs directories : /home/firehawk/miniconda3/envs
/home/firehawk/.conda/envs
platform : linux-64
user-agent : conda/24.5.0 requests/2.31.0 CPython/3.12.3 Linux/6.5.0-35-generic linuxmint/21.3 glibc/2.35 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8 aau/0.4.4 c/. s/. e/.
UID:GID : 1000:1000
netrc file : None
offline mode : False
This is being caused by the code that generates the permissions and groups fields for each app in the custom group field. The "fix" is probably to pull the parts of this that access the database out into lazy() calls so the database isn't queried until the form is loaded. Instead of querying the database to get the list of all apps, get the harvester singleton and get the list of apps from that. Then create the necessary fields for each app and add them to the GOP form, but use lazy() for the queryset value of these fields and call functions that query to build the options.
Describe the bug
I see the following warning when starting the development server with
tethys manage start
with Django 5:This probably has to do with the app harvesting routines that get called on startup. It doesn't seem to be causing actual issues though, so I recommend we suppress the warning somehow.
To Reproduce
tethys manage start
Expected behavior
No ugly warnings.
Errors/Traceback
Screenshots
N/A
Tethys Environment Information
Include output from these commands:
4.2.0.post3.dev38+g59a80e44.d20240620
The text was updated successfully, but these errors were encountered: