Use variable instead of hardcoded path for dynastie root
This commit is contained in:
parent
aefee81385
commit
e99280e21c
|
@ -26,8 +26,8 @@ class Blog(models.Model):
|
|||
report = ''
|
||||
|
||||
def create_paths(self):
|
||||
self.src_path = '/home/soutade/Projets_Perso/dynastie2/dynastie/dynastie/' + 'sites/' + self.name
|
||||
self.output_path = '/home/soutade/Projets_Perso/dynastie2/dynastie/dynastie/' + 'sites/' + self.name + '_output'
|
||||
self.src_path = os.environ['DYNASTIE_ROOT'] + 'sites/' + self.name
|
||||
self.output_path = os.environ['DYNASTIE_ROOT'] + 'sites/' + self.name + '_output'
|
||||
|
||||
def create(self):
|
||||
self.create_paths()
|
||||
|
|
14
settings.py
14
settings.py
|
@ -1,8 +1,16 @@
|
|||
# Django settings for dynastie project.
|
||||
import os
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
if not 'DYNASTIE_ROOT' in os.environ:
|
||||
# manage.py
|
||||
dynastie_root = os.getcwd() + '/dynastie/'
|
||||
else:
|
||||
# Apache
|
||||
dynastie_root = os.environ['DYNASTIE_ROOT']
|
||||
|
||||
ADMINS = (
|
||||
('Gregory Soutade', 'gregory@soutade.fr'),
|
||||
)
|
||||
|
@ -12,7 +20,7 @@ MANAGERS = ADMINS
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': '/home/soutade/Projets_Perso/dynastie2/dynastie/dynastie/dynastie.bdd', # Or path to database file if using sqlite3.
|
||||
'NAME': dynastie_root + 'dynastie.bdd', # Or path to database file if using sqlite3.
|
||||
'USER': '', # Not used with sqlite3.
|
||||
'PASSWORD': '', # Not used with sqlite3.
|
||||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
||||
|
@ -66,7 +74,7 @@ STATIC_ROOT = ''
|
|||
STATIC_URL = '/static/'
|
||||
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = ['/home/soutade/Projets_Perso/dynastie2/dynastie/dynastie/static']
|
||||
STATICFILES_DIRS = [dynastie_root + 'static']
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
|
@ -105,7 +113,7 @@ ROOT_URLCONF = 'dynastie.urls'
|
|||
WSGI_APPLICATION = 'dynastie.wsgi.application'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
"/home/soutade/Projets_Perso/dynastie2/dynastie/dynastie/"
|
||||
dynastie_root
|
||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
|
|
7
wsgi.py
7
wsgi.py
|
@ -14,9 +14,16 @@ framework.
|
|||
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynastie.settings")
|
||||
|
||||
dynastie_root = '/home/soutade/Projets_Perso/dynastie2/dynastie/'
|
||||
if dynastie_root not in sys.path:
|
||||
sys.path.append(dynastie_root)
|
||||
dynastie_root += 'dynastie/'
|
||||
os.environ.setdefault("DYNASTIE_ROOT", dynastie_root)
|
||||
|
||||
# This application object is used by any WSGI server configured to use this
|
||||
# file. This includes Django's development server, if the WSGI_APPLICATION
|
||||
# setting points here.
|
||||
|
|
Loading…
Reference in New Issue
Block a user