gunicorn hosting works staticfiles rearranged
This commit is contained in:
1 parent
977a3eeb82
commit
0e1a2681ea
46 files changed
+76
-41
No files matched your search
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -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',)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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')
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -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',)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,12 +20,15 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'w=76&jm5z(xwiz#pk%%7^9e8-@tcwugm*5t#9w#7$ym^3nq%3a'
|
||||
#SECRET_KEY = 'EAT A DICK MY SITE IS SECURE'
|
||||
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = False
|
||||
#DEBUG = os.environ.get('DJANGO_DEBUG', '') != 'True'
|
||||
ADMINS = [('Matteo', 'clichemail1@gmail.com')]
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]']
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -36,16 +39,19 @@ INSTALLED_APPS = [
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
"whitenoise.runserver_nostatic",
|
||||
"django.contrib.staticfiles",
|
||||
'fontawesomefree',
|
||||
'django.contrib.sites',
|
||||
#'django.contrib.sites',
|
||||
'django.contrib.sitemaps',
|
||||
#'django_cleanup.apps.CleanupConfig',
|
||||
]
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
"kolo.middleware.KoloMiddleware",
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
@@ -65,7 +71,7 @@ TEMPLATE_DIR = os.path.join(BASE_DIR,"templates")
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [TEMPLATE_DIR],
|
||||
'DIRS': [TEMPLATE_DIR,os.path.join(TEMPLATE_DIR,'lottopy')],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
@@ -127,13 +133,13 @@ USE_TZ = True
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
STATIC_ROOT = '/static/'
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, "static"),
|
||||
'/home/williedynamite/projects/django_lottopy/lottopy_site/',
|
||||
#os.path.join(BASE_DIR, "static"),
|
||||
'/home/williedynamite/projects/django_lottopy/lottopy_site/static',
|
||||
'/home/williedynamite/projects/django_lottopy/lottopy_site/lottopy/static',
|
||||
]
|
||||
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
@@ -159,3 +165,32 @@ CELERY_RESULT_BACKEND = "redis://localhost:6379/1"
|
||||
CELERY_TIMEZONE = "America/Eastern"
|
||||
CELERY_TASK_TRACK_STARTED = True
|
||||
#CELERY_TASK_TIME_LIMIT = 30 * 60
|
||||
|
||||
# DataFlair #Logging Information
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
# Version of logging
|
||||
'disable_existing_loggers': False,
|
||||
#disable logging
|
||||
## Handlers #############################################################
|
||||
'handlers': {
|
||||
'file': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': 'dataflair-debug.log',
|
||||
},
|
||||
########################################################################
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
## Loggers ####################################################################
|
||||
'loggers': {
|
||||
'django': {
|
||||
'handlers': ['file', 'console'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG')
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -16,15 +16,16 @@ Including another URLconf
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from django.contrib.sitemaps.views import sitemap
|
||||
from django.contrib.sitemaps import views
|
||||
from lottopy.sitemaps import StaticViewSitemap
|
||||
from lottopy import views
|
||||
from lottopy import urls
|
||||
|
||||
sitemaps = {
|
||||
'static': StaticViewSitemap,
|
||||
'static': StaticViewSitemap(),
|
||||
}
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('lottopy.urls')),
|
||||
path('', include(urls.urlpatterns)),
|
||||
path('admin/', admin.site.urls),
|
||||
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
||||
path('sitemap.xml', views.sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
||||
]
|
||||
@@ -8,9 +8,11 @@ https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
from django.conf import settings
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottopy_site.settings')
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE']='lottopy_site.settings'
|
||||
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottopy_site.settings')
|
||||
application = get_wsgi_application()
|
||||
|
||||
virtualenv = "/home/williedynamite/projects/django_lottopy/django_lottopy/bin/activate"
|
||||
@@ -6,7 +6,8 @@ import sys
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottopy_site.settings')
|
||||
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lottopy_site.settings')
|
||||
os.environ['DJANGO_SETTINGS_MODULE' ]='lottopy_site.settings'
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 52 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 572 KiB |
@@ -3,8 +3,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width;" />
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<meta name="description" property="og:description" content="A site created to predict winning West Virginia Lottery numbers" />
|
||||
<meta name="keywords" content="West Virginia, Lottery, Predictions, Numbers, Winning, how, to, win, thw, lottery, free, generator, edge, best" />
|
||||
<meta name="author" content="Matteo DiBiagio" />
|
||||
@@ -17,7 +16,7 @@
|
||||
<link rel="icon" type="image/x-icon" href="{% static 'assets/favicon.ico' %}" />
|
||||
<!-- Core theme CSS (includes Bootstrap)-->
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="{% static 'css/base.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'css/base.css' %}" rel="stylesheet" type="text/css">
|
||||
<!-- <link rel="stylesheet" href=
|
||||
"https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
|
||||
integrity=
|
||||
@@ -44,7 +43,7 @@
|
||||
<li><a class="dropdown-item" href="#">Contact (WIP)</a></li>
|
||||
<li><hr class="dropdown-divider" /></li>
|
||||
<li><a class="dropdown-item" target="_blank" rel="noreferrer noopener" href="https://wvlottery.com/">WV Lottery Site</a></li>
|
||||
</ul> --->
|
||||
</ul> -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ~/projects/django_lottopy/django_lottopy/bin/activate
|
||||
redis-server &
|
||||
python ~/projects/django_lottopy/lottopy_site/manage.py runserver
|
||||
Reference in new issue
Block a user