forked from awesto/django-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use private wsgi file for Docker images
- Loading branch information
Showing
2 changed files
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
from django.core.management import call_command | ||
from django.core.wsgi import get_wsgi_application | ||
try: | ||
import uwsgidecorators | ||
|
||
@uwsgidecorators.timer(15) | ||
def send_queued_mail(num): | ||
""" | ||
Send queued mail every 15 seconds | ||
""" | ||
call_command('send_queued_mail') | ||
|
||
@uwsgidecorators.cron(0, 6, -1, -1, -1) | ||
def rebuild_index(num): | ||
""" | ||
Rebuild search index in the morning | ||
""" | ||
call_command('rebuild_index', interactive=False) | ||
|
||
@uwsgidecorators.cron(30, 5, -1, -1, 0) | ||
def shopcustomers(num): | ||
""" | ||
Delete expired customers every Sunday | ||
""" | ||
call_command('shopcustomers', delete_expired=True) | ||
|
||
except ImportError: | ||
print("uwsgidecorators not found. Cron and timers are disabled") | ||
|
||
application = get_wsgi_application() | ||
|
||
# rebuild full text search index on first bootstrap | ||
BOOTSTRAP_FILE = os.path.join(os.getenv('DJANGO_WORKDIR', ''), '.bootstrap') | ||
if os.path.isfile(BOOTSTRAP_FILE): | ||
call_command('initialize_shop_demo', interactive=False) | ||
call_command('compilescss') | ||
call_command('collectstatic', interactive=False, ignore_patterns='*.scss') | ||
call_command('rebuild_index', interactive=False) | ||
os.remove(BOOTSTRAP_FILE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,3 @@ | ||
import os | ||
from django.core.management import call_command | ||
from django.core.wsgi import get_wsgi_application | ||
try: | ||
import uwsgidecorators | ||
|
||
@uwsgidecorators.timer(15) | ||
def send_queued_mail(num): | ||
""" | ||
Send queued mail every 15 seconds | ||
""" | ||
call_command('send_queued_mail') | ||
|
||
@uwsgidecorators.cron(0, 6, -1, -1, -1) | ||
def rebuild_index(num): | ||
""" | ||
Rebuild search index in the morning | ||
""" | ||
call_command('rebuild_index', interactive=False) | ||
|
||
@uwsgidecorators.cron(30, 5, -1, -1, 0) | ||
def shopcustomers(num): | ||
""" | ||
Delete expired customers every Sunday | ||
""" | ||
call_command('shopcustomers', delete_expired=True) | ||
|
||
except ImportError: | ||
print("uwsgidecorators not found. Cron and timers are disabled") | ||
|
||
application = get_wsgi_application() | ||
|
||
# rebuild full text search index on first bootstrap | ||
BOOTSTRAP_FILE = os.path.join(os.getenv('DJANGO_WORKDIR', ''), 'bootstrap') | ||
if os.path.isfile(BOOTSTRAP_FILE): | ||
call_command('rebuild_index', interactive=False) | ||
os.remove(BOOTSTRAP_FILE) |