feature/docker
Dmitriy Shesterkin 9 years ago
parent 88d3aff6e9
commit 2c8a71eaa0
  1. 12
      project/__init__.py
  2. 28
      project/celery.py
  3. 8
      project/myauth/emails.py
  4. 12
      project/settings.py
  5. 11
      project/urls.py

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# from .celery import app as celery_app
#
# __all__ = ['celery_app']
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
__all__ = ['celery_app']

@ -1,23 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import celery
print celery.__file__
# from celery import Celery
from django.conf import settings
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
# app = Celery('proj')
app = Celery('project')
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')
# Load task modules from all registered Django app configs.
app.autodiscover_tasks()
# Using a string here means the worker will not have to
# pickle the object when using Windows.
# app.config_from_object('django.conf:settings')
# app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
# @app.task(bind=True)
# def debug_task(self):
# print('Request: {0!r}'.format(self.request))

@ -2,13 +2,13 @@
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from django.conf import settings
# from celery import shared_task
from celery.task import task
SUPPORT_EMAIL = getattr(settings, 'SUPPORT_EMAIL', '')
# @shared_task
@task
def send_registration_email(user_email, confirm_url):
"""Отправить письмо о регистрации нового пользователя."""
template_name = 'myauth/registration_email.txt'
@ -19,7 +19,7 @@ def send_registration_email(user_email, confirm_url):
return email.send()
# @shared_task
@task
def send_reset_password_email(user_email, confirm_url):
"""Отправить письмо с ключём для восстановления пароля."""
template_name = 'myauth/reset_key_email.txt'
@ -30,7 +30,7 @@ def send_reset_password_email(user_email, confirm_url):
return email.send()
# @shared_task
@task
def send_new_password_email(user_email, new_password):
"""Отправить письмо с новым паролем."""
template_name = 'myauth/reset_new_password_email.txt'

@ -5,13 +5,12 @@
import os
import sys
from imp import find_module
from datetime import timedelta
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ROOT_DIR = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
print BASE_DIR
path = lambda *xs: os.path.abspath(os.path.join(os.path.dirname(__file__), *xs))
sys.path.insert(1, path('..'))
@ -19,7 +18,6 @@ sys.path.insert(1, path('.'))
sys.path.insert(1, path('project'))
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
@ -86,6 +84,11 @@ STATICFILES_DIRS = (
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'uqrv8bpqt-#up^ay-)^@bcjjgq1^jy8qc!fkr!1wd*u%)1dg#y'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
@ -286,9 +289,7 @@ BROKER_PASSWORD = "dokumentor"
BROKER_VHOST = "dokumentor"
CELERY_TIMEZONE = 'Europe/Moscow'
CELERY_ACCEPT_CONTENT = ['pickle'] # will be disabled in Celery 3.2
from datetime import timedelta
CALLBACK_SETTINGS = {
'EMAIL_SENDER': '!DEFINE',
@ -330,7 +331,6 @@ TEXT_SAVE_IMAGE_FUNCTION = 'cmsplugin_filer_image.integrations.ckeditor.create_i
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
#'easy_thumbnails.processors.scale_and_crop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)

@ -11,11 +11,6 @@ autocomplete_light.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'project.views.home', name='home'),
# url(r'^project/', include('project.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
@ -41,3 +36,9 @@ if settings.DEBUG:
'show_indexes': True,
}),
)
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
Loading…
Cancel
Save