Added setting for MEDIA_ROOT, and changed the setting for MEDIA_URL; introduced a setting for the IETF main site URL, for use where MEDIA_URL had been used (incorrectly) earlier.

- Legacy-Id: 11263
This commit is contained in:
Henrik Levkowetz 2016-06-02 19:17:38 +00:00
parent 88e56f2c98
commit c83dae57fb
7 changed files with 32 additions and 24 deletions

View file

@ -17,3 +17,11 @@ IDSUBMIT_IDNITS_BINARY = "/usr/local/bin/idnits"
IDSUBMIT_REPOSITORY_PATH = "test/id/"
IDSUBMIT_STAGING_PATH = "test/staging/"
INTERNET_DRAFT_ARCHIVE_DIR = "test/archive/"
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
MEDIA_ROOT = BASE_DIR + '/media/'
MEDIA_URL = '/media/'
PHOTOS_DIRNAME = 'photos'
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME

View file

@ -389,10 +389,10 @@ class Document(DocumentInfo):
else:
filename = self.external_url
if meeting.type_id == 'ietf':
url = '%sproceedings/%s/%s/%s' % (settings.MEDIA_URL,meeting.number,self.type_id,filename)
url = '%sproceedings/%s/%s/%s' % (settings.IETF_HOST_URL,meeting.number,self.type_id,filename)
elif meeting.type_id == 'interim':
url = "%sproceedings/interim/%s/%s/%s/%s" % (
settings.MEDIA_URL,
settings.IETF_HOST_URL,
meeting.date.strftime('%Y/%m/%d'),
session.group.acronym,
self.type_id,

View file

@ -52,7 +52,7 @@ class InterimMeeting(Meeting):
'''
if os.path.exists(self.get_proceedings_path()):
url = "%sproceedings/interim/%s/%s/proceedings.html" % (
settings.MEDIA_URL,
settings.IETF_HOST_URL,
self.date.strftime('%Y/%m/%d'),
self.group().acronym)
return url

View file

@ -269,10 +269,10 @@ def create_proceedings(meeting, group, is_final=False):
meeting_root = get_upload_root(meeting)
if meeting.type.slug == 'ietf':
url_root = "%sproceedings/%s/" % (settings.MEDIA_URL,meeting.number)
url_root = "%sproceedings/%s/" % (settings.IETF_HOST_URL,meeting.number)
else:
url_root = "%sproceedings/interim/%s/%s/" % (
settings.MEDIA_URL,
settings.IETF_HOST_URL,
meeting.date.strftime('%Y/%m/%d'),
group.acronym)
@ -407,7 +407,7 @@ def gen_areas(context):
# append proceedings URL
for group in gmet + gnot:
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.MEDIA_URL,meeting.number,group.acronym)
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.IETF_HOST_URL,meeting.number,group.acronym)
for (counter,area) in enumerate(context['areas'], start=1):
groups_met = {'wg':filter(lambda a: a.parent==area and a.state.slug not in ('bof','bof-conc') and a.type_id=='wg',gmet),
@ -584,7 +584,7 @@ def gen_research(context):
# append proceedings URL
for group in groups:
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.MEDIA_URL,meeting.number,group.acronym)
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.IETF_HOST_URL,meeting.number,group.acronym)
html = render_to_response('proceedings/rg_irtf.html',{
'meeting': meeting,

View file

@ -36,13 +36,13 @@ def get_proceedings_path(meeting,group):
def get_proceedings_url(meeting,group=None):
if meeting.type_id == 'ietf':
url = "%sproceedings/%s/" % (settings.MEDIA_URL,meeting.number)
url = "%sproceedings/%s/" % (settings.IETF_HOST_URL,meeting.number)
if group:
url = url + "%s.html" % group.acronym
elif meeting.type_id == 'interim':
url = "%sproceedings/interim/%s/%s/proceedings.html" % (
settings.MEDIA_URL,
settings.IETF_HOST_URL,
meeting.date.strftime('%Y/%m/%d'),
group.acronym)
return url

View file

@ -100,12 +100,15 @@ USE_I18N = False
USE_TZ = False
MEDIA_URL = 'https://www.ietf.org/'
IETF_ID_URL = MEDIA_URL + 'id/'
IETF_ID_ARCHIVE_URL = MEDIA_URL + 'archive/id/'
MEDIA_ROOT = '/a/www/www6s/lib/dt/media/'
MEDIA_URL = 'https://www.ietf.org/lib/dt/media/'
PHOTOS_DIRNAME = 'photo'
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME
IETF_HOST_URL = 'https://www.ietf.org/'
IETF_ID_URL = IETF_HOST_URL + 'id/'
IETF_ID_ARCHIVE_URL = IETF_HOST_URL + 'archive/id/'
PHOTOS_DIR = '/a/www/www6/'
PHOTO_URL_PREFIX = 'photos/'
# Absolute path to the directory static files should be collected to.
# Example: "/var/www/example.com/static/"

View file

@ -2,6 +2,7 @@
from django.conf import settings
from django.conf.urls import patterns, include
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
@ -82,15 +83,11 @@ if settings.SERVER_MODE in ('development', 'test'):
## maybe preserve some static legacy URLs ?
(r'^(?P<path>(?:images|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT+'ietf/'}),
)
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
)
# This is needed to serve files which are not handled by collectstatic :
# if settings.SERVER_MODE in ('development', 'test'):
# urlpatterns += patterns('',
# (r'^(?P<path>(?:images|css|js|test|static)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}),
# (r'^(?P<path>admin/(?:img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}),
# (r'^(?P<path>secretariat/(img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}),
# (r'^(?P<path>robots\.txt)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL+"dev/"}),
# (r'^_test500/$', lambda x: None),
# (r'^environment/$', 'ietf.help.views.environment'),
# )
import debug
debug.debug = True
debug.show('static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)')