Discussion:
configuration settings.py
Gear Crew
2018-11-11 16:24:12 UTC
Permalink
I want to understand why do that

[image: Screenshot from 2018-11-11 18-09-56.png]
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mike Dewhirst
2018-11-11 21:57:11 UTC
Permalink
Post by Gear Crew
I want to understand why do that
Because Django needs to know which settings module to use so it can find
all your apps and models.

It was designed that way so that a single installation of Django could
be used for multiple projects.
Post by Gear Crew
Screenshot from 2018-11-11 18-09-56.png
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/50ed6de0-bbb8-2b4d-739d-18dc0569f367%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
Gear Crew
2018-11-11 22:00:00 UTC
Permalink
when i can use it in any project?
Post by Mike Dewhirst
Post by Gear Crew
I want to understand why do that
Because Django needs to know which settings module to use so it can find
all your apps and models.
It was designed that way so that a single installation of Django could
be used for multiple projects.
Post by Gear Crew
Screenshot from 2018-11-11 18-09-56.png
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
<javascript:>
Post by Gear Crew
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com
Post by Gear Crew
<
https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com?utm_medium=email&utm_source=footer>.
Post by Gear Crew
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/50608575-2738-4f89-bcb1-5ee55c8d062a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mike Dewhirst
2018-11-11 23:15:40 UTC
Permalink
Post by Gear Crew
when i can use it in any project?
Have a look at wsgi.py created by django-admin when you start a new
project. That should let you understand how to use Django in multiple
projects. In my case, I use different virtualenvs and separate
installations of Django in development. In production I have a single
environment with two running projects ie two Django websites in separate
virtual hosts each with their environment variables managed by Apache.
I'm not sure it is the best way to do it but I haven't encountered any
problems yet.

Here is an example of one of my wsgi.py files ...


from __future__ import unicode_literals, absolute_import, division
import os
import sys
from socket import gethostname

from django.core.wsgi import get_wsgi_application

project = "xxxx"
srvroot = "/var/www"
site_root = "%s/%s" % (srvroot, project)

hname = gethostname()
if "pq4" in hname:
    site = "production"
elif "pq3" in hname:
    site = "staging"
else:
    site = "dev"

if site_root not in sys.path:
    sys.path.insert(0, site_root)

os.environ["DJANGO_SETTINGS_MODULE"] = "%s.settings.%s" % (project, site)
os.environ["PYTHON_EGG_CACHE"] = site_root

# this is the public API - returns django.core.handlers.wsgi.WSGIHandler()
application = get_wsgi_application()
Post by Gear Crew
Post by Gear Crew
I want to understand why do that
Because Django needs to know which settings module to use so it can find
all your apps and models.
It was designed that way so that a single installation of Django could
be used for multiple projects.
Post by Gear Crew
Screenshot from 2018-11-11 18-09-56.png
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from
it, send
<javascript:>
Post by Gear Crew
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
Post by Gear Crew
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com>
<https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com?utm_medium=email&utm_source=footer
<https://groups.google.com/d/msgid/django-users/082717ec-8e88-445d-a0c1-2032f2de9144%40googlegroups.com?utm_medium=email&utm_source=footer>>.
Post by Gear Crew
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/50608575-2738-4f89-bcb1-5ee55c8d062a%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/50608575-2738-4f89-bcb1-5ee55c8d062a%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5922fe86-0362-e33f-10a3-9565946ebaf4%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
Loading...