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["count_formatted"] = self.format_count(movie["count"])
|
||||||
movie["stars_icons"] = self.format_stars(movie["stars"])
|
movie["stars_icons"] = self.format_stars(movie["stars"])
|
||||||
movie["file_name"] = self.fix_path(movie["file_name"])
|
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:
|
if wikipedia:
|
||||||
movie["wiki"] = self.get_wiki(movie)
|
movie["wiki"] = self.get_wiki(movie)
|
||||||
|
|
||||||
def fix_path(self, el):
|
def fix_path(self, file_name):
|
||||||
"""
|
"""
|
||||||
Enmienda ruta a medio.
|
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:
|
letter = file_name[0].upper()
|
||||||
if str(Path(el).parent) == "." and len(el) > 0:
|
if letter.isdigit():
|
||||||
el = f"{el[0]}/{el}"
|
letter = '0'
|
||||||
return settings.URL_DEBUG.format(el)
|
url = f"{settings.URL_CDN}/{letter}/{file_name}"
|
||||||
else:
|
return url
|
||||||
return settings.MEDIA_ROOT / el
|
|
||||||
|
|
||||||
def fix_summ(self, raw):
|
def fix_summ(self, raw):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -144,5 +144,6 @@ DISALLOWED_USER_AGENTS = (
|
||||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||||
SESSION_COOKIE_AGE = 3600
|
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/"
|
URL_MASTODON = "https://mstdn.mx/"
|
||||||
|
|
Loading…
Reference in New Issue