django-manage.py

How to change “python manage.py” to “./manage.py”?

纵饮孤独 提交于 2021-02-10 09:33:42
问题 I want to shorten python manage.py to ./manage.py . This may be simple, but I couldn't find an answer for this. I saw a step by step method in one of the answers for questions about django but I did not memorize that. Tried to search for answers on stackoverflow to no avail. Any help would be appreciated. 回答1: If you're on a Unix based system: Make sure the file has the proper shebang (=this line) as the topmost line (it should have this by default already): #!/usr/bin/env python Make your

How to manage.py loaddata in Django

一世执手 提交于 2020-07-17 05:41:19
问题 I've being fighting with this command for several hours now. If I do python manage.py dumpdata --natural-foreign --> data.json when I loaddata I get the error Could not load contenttypes.ContentType(pk=19): duplicate key value violates unique constraint "django_content_type_app_label_76bd3d3b_uniq" DETAIL: Key (app_label, model)=(misuper, stockitem) already exists. Then if I do python manage.py dumpdata --natural-foreign --exclude=contenttypes --> data.json I get a similar error but with a ̣

How to manage.py loaddata in Django

試著忘記壹切 提交于 2020-07-17 05:41:06
问题 I've being fighting with this command for several hours now. If I do python manage.py dumpdata --natural-foreign --> data.json when I loaddata I get the error Could not load contenttypes.ContentType(pk=19): duplicate key value violates unique constraint "django_content_type_app_label_76bd3d3b_uniq" DETAIL: Key (app_label, model)=(misuper, stockitem) already exists. Then if I do python manage.py dumpdata --natural-foreign --exclude=contenttypes --> data.json I get a similar error but with a ̣

Debuging Django Manage.py Custom commands Pycharm

蹲街弑〆低调 提交于 2020-05-13 13:19:05
问题 I am trying to learn how to debug a django application with PyCharm. In the application we have several custom manage.py commands. If I run there via terminal (external or Pycharm's terminal) they run fine. If I try to run them from PyCharm (Tool -> run manage.py task) so I can debug, I get the following error: Unknown command: 'add_question' Type 'manage.py help' for usage. I started working on the Django Project before using PyCharm, so I created it via django-admin, and we are adding it to

Django: split management commands into subfolders

℡╲_俬逩灬. 提交于 2020-04-08 04:38:24
问题 The Django management commands documentation shows all commands being created in an app/management/commands folder. Is it possible to put commands into subfolders, like app/management/commands/install and app/management/commands/maintenance? How would this be done? 回答1: Unfortunatly, as of Django 1.4 there seems to be no way of doing that. The sources for django.core.management.__init__.py have this method: def find_commands(management_dir): """ Given a path to a management directory, returns

Django: split management commands into subfolders

夙愿已清 提交于 2020-04-08 04:35:07
问题 The Django management commands documentation shows all commands being created in an app/management/commands folder. Is it possible to put commands into subfolders, like app/management/commands/install and app/management/commands/maintenance? How would this be done? 回答1: Unfortunatly, as of Django 1.4 there seems to be no way of doing that. The sources for django.core.management.__init__.py have this method: def find_commands(management_dir): """ Given a path to a management directory, returns

Django dumpdata output is empty

谁说我不能喝 提交于 2020-01-16 18:39:08
问题 we have a Django 1.4.5 project with a PostgreSQL 9.3 backend. Unfortunately we are facing the problems when attempting to create fixtures for one of the apps (which is called sddb ). The database is full of objects that belong to sddb app: (venv)[root@dl380p1 team112]# ./manage.py shell >>> from sddb.models.media import Metadata >>> len(Metadata.objects.all()) 22916 However the dumpdata output is empty: (venv)[root@dl380p1 team112]# ./manage.py dumpdata sddb [] Explicit pointing of database

Django dumpdata output is empty

↘锁芯ラ 提交于 2020-01-16 18:39:06
问题 we have a Django 1.4.5 project with a PostgreSQL 9.3 backend. Unfortunately we are facing the problems when attempting to create fixtures for one of the apps (which is called sddb ). The database is full of objects that belong to sddb app: (venv)[root@dl380p1 team112]# ./manage.py shell >>> from sddb.models.media import Metadata >>> len(Metadata.objects.all()) 22916 However the dumpdata output is empty: (venv)[root@dl380p1 team112]# ./manage.py dumpdata sddb [] Explicit pointing of database