gunicorn hosting works staticfiles rearranged

This commit is contained in:
xi-pinmping committed 2022-06-10 18:53:10 -04:00
1 parent a2e9d8f879
commit 30bbdc4b17
48 files changed
+77 -42

No files matched your search

+1 -1
View File
@@ -2,6 +2,6 @@ from __future__ import absolute_import, unicode_literals
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
from celery import app as celery_app
__all__ = ('celery_app',)
+1 -1
View File
@@ -2,7 +2,7 @@ import os
from celery import Celery
# Set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottopy.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'LottopyConfig.settings')
app = Celery('lottopy')
+3 -3
View File
@@ -1,6 +1,6 @@
from django.contrib import sitemaps
from django.urls import reverse, path
from .views import home, about, robots_txt
from django.urls import reverse
#from .views import home, about, robots_txt
class StaticViewSitemap(sitemaps.Sitemap):
protocol = 'http'
@@ -8,7 +8,7 @@ class StaticViewSitemap(sitemaps.Sitemap):
changefreq='weekly'
def items(self):
return ['home', 'about', 'robots_txt']
return ['home', 'about']
def location(self, item):
return reverse(item)
+10 -8
View File
@@ -6,20 +6,22 @@ from django.conf import settings
from django.core.cache.backends.base import DEFAULT_TIMEOUT
from django.views.decorators.cache import cache_page
from .models import Lotto
import logging
#f = "~/projects/django_lottopy/lottopy_site/lottopy/lottopy_web_edititon/pb_ans.csv"
# MAKE SURE TO START REDIS BEFORE SITE LOADS
CACHE_TTL = getattr(settings, 'CACHE_TTL', DEFAULT_TIMEOUT)
@cache_page(CACHE_TTL)
def base(request):
return render(request, 'lottopy/base.html',
{'nbar': 'home'})
#@cache_page(CACHE_TTL)
#def base(request):
# return render(request, 'base.html',
# {'nbar': 'home'})
logger = logging.getLogger(__file__)
@cache_page(CACHE_TTL)
def home(request):
context = {
'nbar': 'home',
'pbnumbers': Lotto.get_ans(Lotto.files[0]),
@@ -30,11 +32,11 @@ def home(request):
'c25numbers': Lotto.get_ans(Lotto.files[5]),
}
return render(request, 'lottopy/home.html', context)
return render(request, 'home.html', context)
@cache_page(CACHE_TTL)
def about(request):
return render(request, 'lottopy/about.html',
return render(request, 'about.html',
{'nbar': 'about', 'title': 'About'})
@cache_page(CACHE_TTL)
@@ -48,5 +50,5 @@ def robots_txt(require_GET):
return HttpResponse("\n".join(lines), content_type="text/plain")
def sitemap(request):
return render(request,sitemaps,section=None,template_name='sitemap.xml',content_type='application/xml',)
return render(request,sitemap,section=None,template_name='sitemap.xml',content_type='application/xml',)