简体   繁体   中英

How to run django-admin.py, when django is in an egg?

I have inherited a project, which was deployed with buildout and is running fine. I've made some changes in the translation .po file, but to compile to .mo file I need to run

django-admin.py compilemessages

How can I do this, when the only place I find django-admin.py is in an egg? The project is not using virtualenv.

If you are not using virtualenv then everything should be on your PYTHONPATH . With that in mind look at https://github.com/django/django/blob/master/django/bin/django-admin.py :

#!/usr/bin/env python
from django.core import management

if __name__ == "__main__":
    management.execute_from_command_line()

Not the big deal to make your own django-admin.py , isn't it? And that should do the trick. But don't forget to set DJANGO_SETTINGS_MODULE env variable.

Apparently, there was a django file, which set all of the eggs to be in sys.path, and then passed commands to django. I don't know if that is standard in buildout, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM