Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
47016d43
Kaydet (Commit)
47016d43
authored
Eyl 11, 2015
tarafından
Paul Rentschler
Kaydeden (comit)
Tim Graham
Eyl 11, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25203 -- Documented how to pass Apache environment variables to Django.
üst
e3720b99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
modwsgi.txt
docs/howto/deployment/wsgi/modwsgi.txt
+41
-0
No files found.
docs/howto/deployment/wsgi/modwsgi.txt
Dosyayı görüntüle @
47016d43
...
...
@@ -125,6 +125,47 @@ mode`_.
.. _details on setting up daemon mode: http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process
Apache environment variables
============================
If you want to specify a different Django settings file or additional variables
for your Django application via the Apache configuration, you would do it like
this:
.. code-block:: apache
SetEnv DB_USER dbusername
SetEnv DJANGO_SETTINGS_MODULE mysite.alternate-settings
The ``SetEnv`` directive creates Apache environment variables instead of OS
environment variables, so you will need to replace the default ``wsgi.py`` file
with::
import os
from django.core.wsgi import get_wsgi_application
# A tuple of Apache environment variables to pass through to Django.
env_variables_to_pass = ('DB_USER', )
def application(environ, start_response):
"""
Wrapper for the WSGI application that passes environment variables.
"""
os.environ['DJANGO_SETTINGS_MODULE'] = environ.get('DJANGO_SETTINGS_MODULE', 'mysite.settings')
for var in env_variables_to_pass:
os.environ[var] = environ.get(var, '')
return get_wsgi_application()(environ, start_response)
Now you can specify a new settings file in Apache using the
``SetEnv DJANGO_SETTINGS_MODULE ...`` line, and if that setting isn't
specified, it uses ``'mysite.settings'`` as a default. You'll want to change
``mysite.settings`` to reference your own ``settings.py`` module.
Additionally, you can use the ``env_variables_to_pass`` tuple to specify any
other Apache environment variables, such as database login credentials, that
should be passed along to the Django application as OS environment variables.
.. _serving-files:
Serving files
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment