Fix paths for cartel and movie
This commit is contained in:
parent
6396f23855
commit
3cf7440760
|
@ -171,23 +171,19 @@ class MovieQuerySet(models.QuerySet):
|
|||
movie["count_formatted"] = self.format_count(movie["count"])
|
||||
movie["stars_icons"] = self.format_stars(movie["stars"])
|
||||
movie["file_name"] = self.fix_path(movie["file_name"])
|
||||
movie["cartel"] = self.fix_path(movie["cartel"])
|
||||
movie["cartel"] = f"{settings.MEDIA_ROOT}{movie['cartel']}"
|
||||
if wikipedia:
|
||||
movie["wiki"] = self.get_wiki(movie)
|
||||
|
||||
def fix_path(self, el):
|
||||
def fix_path(self, file_name):
|
||||
"""
|
||||
Enmienda ruta a medio.
|
||||
|
||||
La ruta es distinta según se esté en producción o en desarrollo
|
||||
('DEBUG'). La URL_DEBUB apunta a la dirección en nebula.
|
||||
"""
|
||||
if settings.DEBUG:
|
||||
if str(Path(el).parent) == "." and len(el) > 0:
|
||||
el = f"{el[0]}/{el}"
|
||||
return settings.URL_DEBUG.format(el)
|
||||
else:
|
||||
return settings.MEDIA_ROOT / el
|
||||
letter = file_name[0].upper()
|
||||
if letter.isdigit():
|
||||
letter = '0'
|
||||
url = f"{settings.URL_CDN}/{letter}/{file_name}"
|
||||
return url
|
||||
|
||||
def fix_summ(self, raw):
|
||||
"""
|
||||
|
|
|
@ -144,5 +144,6 @@ DISALLOWED_USER_AGENTS = (
|
|||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||
SESSION_COOKIE_AGE = 3600
|
||||
|
||||
URL_CDN = "https://mauflix.cuates.net/{}"
|
||||
# ~ URL_CDN = "https://mauflix.cuates.net/{}"
|
||||
URL_CDN = "http:/124.124.24.24/mauflix"
|
||||
URL_MASTODON = "https://mstdn.mx/"
|
||||
|
|
Loading…
Reference in New Issue