Hi Manas,

I go this error on one of my script I wrote a few months ago, I delete some 
data from my database by mistake when I re-run the script I got the error 
you wrote or maybe similar. The error is a bit longer than but I input a 
few line here:

File 
"/home/dilmac/workplace/alfaenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
 
line 164, in _add_installed_apps_translations
    "The translation infrastructure cannot be initialized before the "
django.core.exceptions.AppRegistryNotReady: The translation infrastructure 
cannot be initialized before the apps registry is ready. Check that you 
don't make non-lazy gettext calls at import time.


I searched a lot not able to fix but I found solution for with this two 
line below fixed my problem but may affect other thing not sure !!

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

It fixed the bug for me but make sure first what does the code than try.

Regards
Dilshad





On Friday, 12 June 2015 20:03:25 UTC+1, Manas Hardas wrote:
>
> Sorry if this is not an appropriate place for a django/djcelery related 
> error.
>
> I am getting the following error:
>
> File 
> "/Library/Python/2.7/site-packages/Django-1.8.2-py2.7.egg/django/utils/translation/trans_real.py",
>  line 164, in _add_installed_apps_translations"The translation infrastructure 
> cannot be initialized before the "
> django.core.exceptions.AppRegistryNotReady: The translation infrastructure 
> cannot be initialized before the apps registry is ready. Check that you don't 
> make non-lazy gettext calls at import time.
>
> I have a project which is not really a django app but a celery app. 
> Therefore, I have not created a wsgi.py or models.py or any of the 
> typical files created by django-admin when a project or app is started.
>
> I only want to use djcelery to be able to create periodic tasks using the 
> djcelery.schedules.DatabaseScheduler like specified here Add, modify, 
> remove celery.schedules at run time 
> <http://stackoverflow.com/questions/23740880/add-modify-remove-celery-schedules-at-run-time?lq=1>
>  and 
> here How to dynamically add / remove periodic tasks to Celery (celerybeat) 
> <http://stackoverflow.com/questions/10194975/how-to-dynamically-add-remove-periodic-tasks-to-celery-celerybeat>
>
> The solution to the problem as given here (AppRegistryNotReady, 
> translation bug when deploying with uWSGI 
> <https://code.djangoproject.com/ticket/23146>) requires me to make 
> changes to vassal.ini file. There is no vassal.ini file in my 
> implementation.
>
> I will briefly describe my proj -
>
> proj
>   apps.py
>   tasks.py
>   celeryconfig.py
>   runproj.py
> - apps.pyfrom celery import Celery
> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'celeryconfig')
> myapp = Celery('myapp')
> myapp.config_from_object('celeryconfig')if __name__ == '__main__'
>     myapp.worker_main('--loglevel=DEBUG', '-B', '-S', 
> 'djcelery.schedules.DatabaseScheduler')
> - tasks.pyfrom apps import [email protected](name='proj.msg_printer')def 
> msg_printer(msg):
>     print msg
> - runproj.pyfrom djcelery.models import PeriodicTask, IntervalSchedule
> intSch = IntervalSchedule(period='seconds', every=30)
> periodic_task = PeriodicTask(
>   name = '30-sec-msg-printer',
>   task = 'proj.tasks.msg_printer',
>   interval = intSch,
>   args=json.dump(['such-wow']),
>  )
> periodic_task.save()
> - celeryconfig.py
> CELERY_ACCEPT_CONTENT = ['pickle', 'json']
> BROKER_URL = 'amqp://guest@localhost'
> CELERY_IMPORTS = ('proj.tasks')
> CELERY_QUEUES = [Queue('default', Exchange('default', type='direct'), 
> routing_key='default')]
> #DJANGO SETTINGS
> INSTALLED_APPS = 
> ('django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','djcelery',)
>
> DATABASES = {'default': {
>     'ENGINE': 'django.db.backends.sqlite3',
>     'NAME': os.path.join('/home', 'test.db'),
>     }}
>
> Before I run the workers I created the required tables using the django-admin 
> migrate command. I can see the relevant tables to store interval 
> schedules and periodic tasks in the /home/test.db database.
>
> First I run the workers - $python apps.py Then I save a schedule to the 
> database to be executed repeatedly by celerybeat daemon - $python 
> runproj.py
>
> Any thoughts? Thank you.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f02ba6bb-de0a-48c4-9db5-ff457de60f76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to