Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overwrite DJANGO_SETTINGS_MODULE #279

Merged
merged 4 commits into from
Feb 7, 2022

Conversation

physikerwelt
Copy link
Contributor

When deploying praktomat via git changes to the file
/src/settings/local.py might cause merge conflicts.
A possible solution to this is to configure
the settings file in the apache config. For instance

SetEnv DJANGO_SETTINGS_MODULE settings.local

See also #259

When deploying praktomat via git changes to the file
/src/settings/local.py might cause merge conflicts.
A possible solution to this is to configure
the settings file in the apache config. For instance
```
SetEnv DJANGO_SETTINGS_MODULE settings.local
```

See also KITPraktomatTeam#259
@ifrh
Copy link
Contributor

ifrh commented Oct 31, 2017

Have you tried with your above changes to run multiple praktomat instances on the same server?

@physikerwelt
Copy link
Contributor Author

Have you tried with your above changes to run multiple praktomat instances on the same server?

Yes.

@ratefuchs ratefuchs merged commit 51c03f7 into KITPraktomatTeam:master Feb 7, 2022
ifrh pushed a commit to ifrh/Praktomat that referenced this pull request Feb 8, 2022
The unit test code for praktomat.wsgi of commit 600e270 inside pullrequest KITPraktomatTeam#268
didn't "know" changes inside praktomat.wsgi of commit physikerwelt/Praktomat@3c697c0 inside pullrequest KITPraktomatTeam#279
This is a first step for fixing. Lets create a travis run to have a look on travis output.
@ifrh
Copy link
Contributor

ifrh commented Feb 18, 2022

Have you tried with your above changes to run multiple praktomat instances on the same server?

Yes.

If I found some information [1],[2],[3],[4] that by running the Django instances in separate processes there can be no possibility of environment variables leaking from one to the other.
But from my understanding WSGIScriptAlias with parameter process-group inside Macro Praktomat ( https://github.com/KITPraktomatTeam/Praktomat/blob/master/documentation/apache_praktomat_wsgi.conf#L29 ) needs an unique value for
separating differend django applications running on the same server.

We could change WSGIScriptAlias /$id $path/Praktomat/wsgi/praktomat.wsgi process-group=local
to i.e. WSGIScriptAlias /$id $path/Praktomat/wsgi/praktomat.wsgi process-group=local_$id

And consequently os.environ.setdefault('DJANGO_SETTINGS_MODULE... in https://github.com/KITPraktomatTeam/Praktomat/blob/master/wsgi/praktomat.wsgi#L26 should get a small change too: That means read environment variable mod_wsgi.process_group and remove substring $id before storing it to environment variable DJANGO_SETTINGS_MODULE,

[1] http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html
[2] https://gist.github.com/GrahamDumpleton/b380652b768e81a7f60c?permalink_comment_id=2970235#gistcomment-2970235
Edit : 18.2.2022, 16:46
[3]: https://stackoverflow.com/a/19759904
[4]: https://stackoverflow.com/a/25496668

@ifrh
Copy link
Contributor

ifrh commented Feb 19, 2022

We could change WSGIScriptAlias /$id $path/Praktomat/wsgi/praktomat.wsgi process-group=local to i.e. WSGIScriptAlias /$id $path/Praktomat/wsgi/praktomat.wsgi process-group=local_$id

And consequently os.environ.setdefault('DJANGO_SETTINGS_MODULE... in https://github.com/KITPraktomatTeam/Praktomat/blob/master/wsgi/praktomat.wsgi#L26 should get a small change too: That means read environment variable mod_wsgi.process_group and remove substring $id before storing it to environment variable DJANGO_SETTINGS_MODULE,

I created the change and put it into repository via commit ifrh@12182e7 which is part of and is part of pullrequest Bugfix merge marathon feb2022 ... some more beside "Delete duplicate MOD_XSENDFILE_V1_0 setting" #320

concrete parts are here

@ifrh
Copy link
Contributor

ifrh commented Feb 19, 2022

That means read environment variable mod_wsgi.process_group and remove substring $id before storing it to environment variable DJANGO_SETTINGS_MODULE,

I created the change and put it into repository via commit ifrh@12182e7

With that commit part ifrh@12182e7#diff-7b5d5f52cec25641ba9f79bd9cda4e6804a8dd95f18274d479faffa9f9e50253R26 I repair a bug resulting from a misunderstanding : DJANGO_SETTINGS_MODULE lives as environment variable, but mod_wsgi.process_group is not an environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants