Skip to content

Commit c83dae5

Browse files
committed
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
1 parent 88e56f2 commit c83dae5

7 files changed

Lines changed: 32 additions & 24 deletions

File tree

docker/settings_local.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@
1717
IDSUBMIT_REPOSITORY_PATH = "test/id/"
1818
IDSUBMIT_STAGING_PATH = "test/staging/"
1919
INTERNET_DRAFT_ARCHIVE_DIR = "test/archive/"
20+
21+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
22+
23+
MEDIA_ROOT = BASE_DIR + '/media/'
24+
MEDIA_URL = '/media/'
25+
26+
PHOTOS_DIRNAME = 'photos'
27+
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME

ietf/doc/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ def get_absolute_url(self):
389389
else:
390390
filename = self.external_url
391391
if meeting.type_id == 'ietf':
392-
url = '%sproceedings/%s/%s/%s' % (settings.MEDIA_URL,meeting.number,self.type_id,filename)
392+
url = '%sproceedings/%s/%s/%s' % (settings.IETF_HOST_URL,meeting.number,self.type_id,filename)
393393
elif meeting.type_id == 'interim':
394394
url = "%sproceedings/interim/%s/%s/%s/%s" % (
395-
settings.MEDIA_URL,
395+
settings.IETF_HOST_URL,
396396
meeting.date.strftime('%Y/%m/%d'),
397397
session.group.acronym,
398398
self.type_id,

ietf/secr/proceedings/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_proceedings_url(self, group=None):
5252
'''
5353
if os.path.exists(self.get_proceedings_path()):
5454
url = "%sproceedings/interim/%s/%s/proceedings.html" % (
55-
settings.MEDIA_URL,
55+
settings.IETF_HOST_URL,
5656
self.date.strftime('%Y/%m/%d'),
5757
self.group().acronym)
5858
return url

ietf/secr/proceedings/proc_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ def create_proceedings(meeting, group, is_final=False):
269269

270270
meeting_root = get_upload_root(meeting)
271271
if meeting.type.slug == 'ietf':
272-
url_root = "%sproceedings/%s/" % (settings.MEDIA_URL,meeting.number)
272+
url_root = "%sproceedings/%s/" % (settings.IETF_HOST_URL,meeting.number)
273273
else:
274274
url_root = "%sproceedings/interim/%s/%s/" % (
275-
settings.MEDIA_URL,
275+
settings.IETF_HOST_URL,
276276
meeting.date.strftime('%Y/%m/%d'),
277277
group.acronym)
278278

@@ -407,7 +407,7 @@ def gen_areas(context):
407407

408408
# append proceedings URL
409409
for group in gmet + gnot:
410-
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.MEDIA_URL,meeting.number,group.acronym)
410+
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.IETF_HOST_URL,meeting.number,group.acronym)
411411

412412
for (counter,area) in enumerate(context['areas'], start=1):
413413
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):
584584

585585
# append proceedings URL
586586
for group in groups:
587-
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.MEDIA_URL,meeting.number,group.acronym)
587+
group.proceedings_url = "%sproceedings/%s/%s.html" % (settings.IETF_HOST_URL,meeting.number,group.acronym)
588588

589589
html = render_to_response('proceedings/rg_irtf.html',{
590590
'meeting': meeting,

ietf/secr/utils/meeting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def get_proceedings_path(meeting,group):
3636

3737
def get_proceedings_url(meeting,group=None):
3838
if meeting.type_id == 'ietf':
39-
url = "%sproceedings/%s/" % (settings.MEDIA_URL,meeting.number)
39+
url = "%sproceedings/%s/" % (settings.IETF_HOST_URL,meeting.number)
4040
if group:
4141
url = url + "%s.html" % group.acronym
4242

4343
elif meeting.type_id == 'interim':
4444
url = "%sproceedings/interim/%s/%s/proceedings.html" % (
45-
settings.MEDIA_URL,
45+
settings.IETF_HOST_URL,
4646
meeting.date.strftime('%Y/%m/%d'),
4747
group.acronym)
4848
return url

ietf/settings.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,15 @@
100100

101101
USE_TZ = False
102102

103-
MEDIA_URL = 'https://www.ietf.org/'
104-
IETF_ID_URL = MEDIA_URL + 'id/'
105-
IETF_ID_ARCHIVE_URL = MEDIA_URL + 'archive/id/'
103+
MEDIA_ROOT = '/a/www/www6s/lib/dt/media/'
104+
MEDIA_URL = 'https://www.ietf.org/lib/dt/media/'
105+
PHOTOS_DIRNAME = 'photo'
106+
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME
107+
108+
IETF_HOST_URL = 'https://www.ietf.org/'
109+
IETF_ID_URL = IETF_HOST_URL + 'id/'
110+
IETF_ID_ARCHIVE_URL = IETF_HOST_URL + 'archive/id/'
106111

107-
PHOTOS_DIR = '/a/www/www6/'
108-
PHOTO_URL_PREFIX = 'photos/'
109112

110113
# Absolute path to the directory static files should be collected to.
111114
# Example: "/var/www/example.com/static/"

ietf/urls.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from django.conf import settings
44
from django.conf.urls import patterns, include
5+
from django.conf.urls.static import static
56
from django.contrib import admin
67
from django.views.generic import TemplateView
78
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
@@ -82,15 +83,11 @@
8283
## maybe preserve some static legacy URLs ?
8384
(r'^(?P<path>(?:images|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT+'ietf/'}),
8485
)
86+
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
8587
)
8688

87-
# This is needed to serve files which are not handled by collectstatic :
88-
# if settings.SERVER_MODE in ('development', 'test'):
89-
# urlpatterns += patterns('',
90-
# (r'^(?P<path>(?:images|css|js|test|static)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}),
91-
# (r'^(?P<path>admin/(?:img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}),
92-
# (r'^(?P<path>secretariat/(img|css|js)/.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL}),
93-
# (r'^(?P<path>robots\.txt)$', 'django.views.static.serve', {'document_root': settings.STATIC_LOCAL+"dev/"}),
94-
# (r'^_test500/$', lambda x: None),
95-
# (r'^environment/$', 'ietf.help.views.environment'),
96-
# )
89+
import debug
90+
debug.debug = True
91+
debug.show('static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)')
92+
93+

0 commit comments

Comments
 (0)