django-manage.py

Django - sqlclear fails to delete database with AbstractUser foreign key constraints

大憨熊 提交于 2019-12-13 01:07:14
问题 I'm using Django 1.6 + MySQL. My model has a custom_user class that extends AbstractUser. class CustomUser(AbstractUser): dob = models.DateField() class Meta: db_table = 'custom_user' I want to delete the database with ./manage.py sqlclear | ./manage.py dbshell (as mentioned here) The output of sqlclear is BEGIN; DROP TABLE `design`; DROP TABLE `company`; ALTER TABLE `custom_user_user_permissions` DROP FOREIGN KEY `customuser_id_refs_id_da27cb33`; ALTER TABLE `custom_user_groups` DROP FOREIGN

Django add management command without installing as app

好久不见. 提交于 2019-12-12 15:26:00
问题 I've created a package for use with django, the main feature of which is accessible through a management command. However, in order to make management commands accessible, django seems to insist on the package being listed as an app in INSTALLED_APPS in settings.py . This application is merely used as part of our build process while doing intergration testing. It does not even need to be installed on developer machines, let alone end up in our production environment. However, since it needs

Django's manage.py shows old commands

断了今生、忘了曾经 提交于 2019-12-11 01:59:43
问题 I am coding my own whl-package and after creating some new management-commands and deleting some old ones I was pretty happy with myself. Except after building my wheel-package (with setup.py bdist_wheel ) and installing it on my test server (with pip install -U project-2.0b3-py2.py3-none-any.whl ), I noticed that the help of manage.py still show the old commands. It will even try to run the old commands, so there is some old stuff there, but I was not quite sure why or how. I tried

manage.py sql command for django models - Django

空扰寡人 提交于 2019-12-10 19:26:30
问题 just wondering... but is it possible to generate SQL commands for django's models? e.g. the session model python manage.py sql django Any ideas? 回答1: You need to mention the name of the specific app that comes with django, such as python manage.py sql auth python manage.py sql admin I find it a bit clumsy that you can't give fully-qualified names (such as django.contrib.auth), but using just the last part of the name seems to work fine. 回答2: This is no longer possible with django migrations

Satchmo clonesatchmo.py ImportError: cannot import name execute_manager

故事扮演 提交于 2019-12-08 15:35:15
问题 I get satchmo to try, but I have a great problem at first try, and I don't understand whats wrong. When I making $ python clonesatchmo.py into clear django project, it trows an error: $ python clonesatchmo.py Creating the Satchmo Application Customizing the files Performing initial data synching Traceback (most recent call last): File "manage.py", line 18, in <module> from django.core.management import execute_manager ImportError: cannot import name execute_manager Traceback (most recent call

Are there any purposes for the management folder in Django other than commands?

人走茶凉 提交于 2019-12-08 15:05:23
问题 Why are management commands not in their own app-level folder? Are there other items which can be added to the management directory or is this structure purely vestigial? 回答1: I don't know the history, but it seems semi-vestigial to me. As for other stuff that can be put in the management dir, the comment about signals above hints at one answer. One thing I do when trying to answer such questions is to look at the contrib apps to see what they do. Some interesting bits to be found: auth

Django manage.py runserver never finishes “validating models”

拜拜、爱过 提交于 2019-12-08 08:48:24
问题 I am trying to follow the django tutorial. I am running on windows+eclipse. When I run python manage.py runserver I get the message Validating models... and afterwards see no progress... Am I doing something wrong? 回答1: I've got my answer in another question: can't get django to work in eclipse + windows When I ran the server with the --noreload option, I saw that there's an exception thrown. After I fixed that, the output does complete, and says: Validating models... 0 errors found Django

Python 2.6 on MacOSX - ImportError: No module named _collections

偶尔善良 提交于 2019-12-08 07:33:50
问题 I'm a little bit baffled by this error I'm getting when I try to runserver or syncdb - the server was running just fine the other night when I last logged on, so I have no idea why all of a sudden it's not working. Google gave me the following page but it doesn't really address my issue. Let me know if you need more if the console information below isn't enough. I really am not very efficient with django yet, complete beginner really, and I'm not sure why this isn't working. Pythoness-410

custom django-admin commands - AttributeError: 'Command' object has no attribute 'stdout'

我与影子孤独终老i 提交于 2019-12-06 09:11:11
Following the example of writing a custom django-admin command here , I've created the following custom command: from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): args = '' help = 'Test command' def handle(self, *args, **options): self.stdout.write("Hello World!") Surprisingly, I receive the following stack trace: Traceback (most recent call last): File "D:\My Documents\Dev\MyProject\svn\trunk\dj_project\manage.py", line 11, in <module> execute_manager(settings) File "C:\Python26\lib\site-packages\django\core\management\__init__.py", line 438, in

Django manage.py : Is it possible to pass command line argument (for unit testing)

允我心安 提交于 2019-12-05 09:49:25
问题 Is it possible to pass command line arguments to Django's manage.py script, specifically for unit tests? i.e. if I do something like manage.py test myapp -a do_this Can I receive the value do_this in the setUp function of unit test? P.S. @Martin asked the justification for using command line args in tests: Some extensive tests take a lot of time and don't need to be run before every commit. I want to make them optional. Occasional debug messages printed by my test cases should be optional