Skip to content

Commit

Permalink
Runs but no WS
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Mar 12, 2024
1 parent 126cd47 commit 1d25cf2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 30 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY ./tracker/tracker tracker

RUN yarn build

FROM python:3.11
FROM python:3.12

WORKDIR /app

Expand All @@ -35,16 +35,18 @@ COPY \
./tracker/setup.py \
./

COPY ./tracker/tracker tracker
COPY --from=client /app/tracker/ tracker
COPY ./tracker/tracker tracker
RUN pip install -e .
#RUN pip install gunicorn
RUN pip install 'uvicorn[daphne]' gunicorn

WORKDIR /app/tracker_development
COPY ./settings.py ./local_statics.py ./routing.py ./urls.py /app/tracker_development/tracker_development/
COPY ./settings.py ./wsgi.py ./asgi.py ./local_statics.py ./routing.py ./urls.py /app/tracker_development/tracker_development/
COPY ./entrypoint.sh ./
RUN mkdir db

#RUN pip install ./donation-tracker

RUN apt update
RUN apt install -y locales
#RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
Expand Down
16 changes: 16 additions & 0 deletions asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for tracker_development project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tracker_development.settings')

application = get_asgi_application()
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ rm -rf /var/ww/html/static/gen || true
python manage.py collectstatic --noinput

if [ -x "$(command -v gunicorn)" ]; then
gunicorn --bind 0.0.0.0:8000 tracker_development.wsgi
# gunicorn --bind 0.0.0.0:8000 tracker_development.wsgi
python -m gunicorn --bind 0.0.0.0:8000 tracker_development.asgi:application -k uvicorn.workers.UvicornWorker
else
echo "Gunicorn not installed: Using built-in server."
# watchmedo shell-command --patterns="*.css" -R -c "python manage.py collectstatic --noinput" &
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tracker_development.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
25 changes: 9 additions & 16 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

try:
import tracker_development.local as local
print('Loaded normal settings')
except ImportError:
try:
import tracker_development.local_statics as local
print('Loaded statics settings')
except ImportError:
import tracker_development.example_local as local

Expand Down Expand Up @@ -82,15 +84,6 @@
# to load the internationalization machinery.
USE_I18N = True

gettext = lambda x: x
LANGUAGES = (
# ('de',gettext('German')),
('en',gettext('English')),
# ('ja',gettext('Japanese')),
# ('nl',gettext('Dutch')),
# ('pl',gettext('Polish')),
)

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
Expand Down Expand Up @@ -124,19 +117,19 @@

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
]

# Make this unique, and don't share it with anybody.
SECRET_KEY = local.SECRET_KEY

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
TEMPLATE_LOADERS = [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
Expand Down Expand Up @@ -172,7 +165,7 @@
},
]

INSTALLED_APPS = (
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
Expand All @@ -187,7 +180,7 @@
'timezone_field',
'ajax_select',
'mptt',
)
]

EMAIL_BACKEND = local.EMAIL_BACKEND

Expand All @@ -197,7 +190,7 @@
# Pull in the tracker's lookup channels
from tracker import ajax_lookup_channels
AJAX_LOOKUP_CHANNELS = ajax_lookup_channels.AJAX_LOOKUP_CHANNELS
ASGI_APPLICATION = 'routing.application'
ASGI_APPLICATION = 'tracker_development.routing.application'
CHANNEL_LAYERS = {'default': {'BACKEND': 'channels.layers.InMemoryChannelLayer'}}

# AUTHENTICATION_BACKENDS = (
Expand Down
2 changes: 1 addition & 1 deletion tracker
Submodule tracker updated 0 files
19 changes: 12 additions & 7 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
"""
WSGI config for tracker_development project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""

import os
import sys
import logging
import inspect

# I put it ahead so that it will take the local paypal app over the global one
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
os.environ.setdefault("LC_ALL", "en_US.utf8")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tracker_development.settings')

application = get_wsgi_application()

logger = logging.getLogger('')
Expand Down

0 comments on commit 1d25cf2

Please sign in to comment.