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

Improved docs regarding UTF-8 support with Apache and mod_wsgi. #14944

Merged
merged 1 commit into from Oct 8, 2021

Conversation

fraziern
Copy link

@fraziern fraziern commented Oct 5, 2021

When I first set up Django on a Linux server, I found that configuring mod_wsgi and Apache to support UTF-8 files was tricky. The current Django documentation could be improved with (a) an additional example of how to configure mod_wsgi, and (b) to clarify that files with non-ASCII content (and not just files with non-ASCII file names) can be affected.

This PR is to update the docs in a couple of places for this purpose.

The example I added comes from this blog post:

As is detailed in the Django documentation, you can set the environment variables yourself.

export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
The problem now is where do you set them. This is because they need to be set in the environment under which the initial Apache process starts up.
...

A further problem is that Linux systems generally do not use the Apache Software Foundation installation layout and do away with the 'envvars' file completely. In these cases you have to find the correct system init script file to add the settings in. What file this is, differs between Linux distributions.

So being able to override the value for the lang and locale can be a pain. It can differ between Linux distributions and even changing the file may not survive system package upgrades.

@github-actions
Copy link

github-actions bot commented Oct 5, 2021

Hello @fraziern! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

@kezabelle
Copy link
Contributor

I've checked the mod_wsgi WSGIDaemonProcess documentation history, and yeah the lang= and locale= documentation doesn't turn up until 2016, in commit message Add numerous missing options to documentation for WSGIDaemonProcess which is present in tags 4.5.8 through present.

The documentation admonition in Django's modwsgi.txt dates from 2015, and references ticket 17686 and ticket 17816. Thus at the time it was written, presumably no-one knew the options existed, or they were treated as internal-only.

The docs for lang= and locale= very much encourage their use:

Unless you need a special language locale, set this to en_US.UTF-8. Whether the lang or locale option works best can depend on the system being used. Set both if you aren’t sure which is appropriate.

@felixxm felixxm changed the title Updated docs for mod_wsgi and unicode regarding UTF-8 setup Improved docs regarding UTF-8 support with Apache and mod_wsgi. Oct 8, 2021
@felixxm
Copy link
Member

felixxm commented Oct 8, 2021

@fraziern Thanks for this patch 👍 Welcome aboard ⛵ I pushed minor edits.

Maybe you'd like to review patch in the same area, see #14939.

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