> I ran into a similar issue overriding the 'url_scheme'. I have a similar use-case. I define a url in the app settings of the .ini, and one of my test systems runs the app on a different port -- so I need to catch that and either automatically fix it, or immediately error out during startup. Otherwise random tests fail and it's a pain to figure this out. On Monday, March 3, 2025 at 3:48:38 PM UTC-5 Mike Orr wrote:
> I ran into a similar issue overriding the 'url_scheme'. I need to > override it via an environment variable in Docker containers. I ended > up creating a run script that uses 'pyramid.paster' functions, so now > I have separate app and logging INI files, and the server > configuration is handled by the script. > > I did find out that 'get_appsettings' requires a 'use=' key, even > though it seems unused if you call the application's main() yourself. > So that's another case where pserve/PasteDeploy assumes a pretty > narrow usage range. > > On Mon, Mar 3, 2025 at 7:50 AM Jonathan Vanasco <[email protected]> wrote: > > > > Is there any way to access the configured host/port in the > `project/__init__.py::main(global_config, **settings):` block? Those vars > are set in the `[server:main]` block of a `config.ini` file - not > `[app:main]`. It looks like I can determine them in the context of a > request due to the implementation details of WSGI, but I need to access > them in the initial app setup. > > > > It seems like they may not be passed onto Pyramid and I would need to > parse the configuration file and pull it out myself. > > > > -- > > You received this message because you are subscribed to the Google > Groups "pylons-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > To view this discussion visit > https://groups.google.com/d/msgid/pylons-discuss/f24eac45-de01-4ed1-812b-1f5d31a85081n%40googlegroups.com > . > > > > -- > Mike Orr <[email protected]> > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/pylons-discuss/da3c5b2b-eb43-4abc-a6ae-d0c216293c67n%40googlegroups.com.
