I want to use djangular in my django project but I have a problem.
the problem is that when i want to create djangularapp in django project with this commant python manage.py startangularapp djangularTest it shows me the below error:
C:\Users\Mohammad\Desktop\andjango>python manage.py startangularapp djangularTes t Traceback (most recent call last): File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv) File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
utility.execute() File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python34\lib\site-packages\django\core\management\base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options) File "C:\Python34\lib\site-packages\django\core\management\base.py", line 441, in execute
output = self.handle(*args, **options) File "C:\Python34\lib\site-packages\djangular-0.3.0b1-py3.4.egg\djangular\mana gement\commands\startangularapp.py", line 20, in handle
mgmt.call_command('startapp', app_name, target, **options)
TypeError: call_command() got multiple values for argument 'name'
Read your error traceback once. The first line clearly shows that instead of using python manage.py startangularapp djangularTest you used python manage.py startangularapp djangularTes t.This means that django reads two name values.
Related
I m trying to create superuser in Django (1.11) on Python (3.6.4) on Mac (10.13.3).
After entering username, I'm pressing enter. enter won't take me to next input.
$ python manage.py createsuperuser
Username (leave blank to use 'neon'): admin^M^M^M^M^M^M^M^M^C^CKeyboardInterrupt
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/neon/workspace/jp/lib/python3.6/site-packages/Django-1.11-py3.6.egg/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/Users/neon/workspace/jp/lib/python3.6/site-packages/Django-1.11-py3.6.egg/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/neon/workspace/jp/lib/python3.6/site-packages/Django-1.11-py3.6.egg/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/neon/workspace/jp/lib/python3.6/site-packages/Django-1.11-py3.6.egg/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute
return super(Command, self).execute(*args, **options)
File "/Users/neon/workspace/jp/lib/python3.6/site-packages/Django-1.11-py3.6.egg/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/Users/neon/workspace/jp/lib/python3.6/site-packages/Django-1.11-py3.6.egg/django/contrib/auth/management/commands/createsuperuser.py", line 116, in handle
username = self.get_input_data(self.username_field, input_msg, default_username)
File "/Users/neon/workspace/jp/lib/python3.6/site-packages/Django-1.11-py3.6.egg/django/contrib/auth/management/commands/createsuperuser.py", line 192, in get_input_data
raw_value = input(message)
SystemError: <built-in function input> returned a result with an error set
As mentioned in comments, both ctrl+j and running command in new terminal worked.
I already have an application using PostgreSQL as db. I want to build a service using Django. Tried "inspectdb"... but it is giving an expection:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/inspectdb.py", line 25, in handle
for line in self.handle_inspection(options):
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/inspectdb.py", line 70, in handle_inspection
constraints = connection.introspection.get_constraints(cursor, table_name)
File "/usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql/introspection.py", line 172, in get_constraints
"foreign_key": tuple(used_cols[0].split(".", 1)) if kind.lower() == "foreign key" else None,
IndexError: list index out of range
Figured out the issue.
Apparently, the db user didn't have sufficient permissions.
I have some tests in myproject/core/tests/test_views_front.py. When I try to run python manage.py test myproject.core.tests.test_views_front I get:
NOTE: Using test database settings!
NOTE: Logging is disabled!
Traceback (most recent call last):
File "manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/__in
it__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/__in
it__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/comm
ands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/base
.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/comm
ands/test.py", line 71, in execute
super(Command, self).execute(*args, **options)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/base
.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/south/management/commands/t
est.py", line 8, in handle
super(Command, self).handle(*args, **kwargs)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/comm
ands/test.py", line 88, in handle
failures = test_runner.run_tests(test_labels)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/test/runner.py", lin
e 144, in run_tests
suite = self.build_suite(test_labels, extra_tests)
File "/home/ben/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/test/runner.py", lin
e 63, in build_suite
tests = self.test_loader.loadTestsFromName(label)
File "/usr/lib/python2.7/unittest/loader.py", line 100, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_views_front'
This also happens if I run python manage.py test myproject.core.tests.test_views_front.FrontPageViewTests. However, if I simply run python manage.py test or python manage.py test myproject.core.tests then all the tests (including the ones in the aforementioned file) run fine. I found this solution but my test file seems to import fine, without any errors or warnings. Is there anything else I might be missing?
You can't run test from a specific file in Django. You can either run all the test from myproject.core.tests like you did or a specific TestCase:
myproject.core.tests.YourTestCase
I have a local python environment working, but when I try and load in initial data.
python manage.py loaddata initial_data.json
I get an error about "RemovedInDjango18Warning"?
I am not a python dev to say - so this error is new to me.
C:\Python27\aasoo>python manage.py loaddata initial_data.json
C:\Python27\lib\site-packages\djorm_pgfulltext\models.py:323: RemovedInDjango18Warning: `SearchManagerMixIn.get_query_set` method should be renamed `get_queryset`.
class SearchManager(SearchManagerMixIn, models.Manager):
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 338, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\modeltranslation\management\commands\loaddata.py", line 50, in handle
return super(Command, self).handle(*fixture_labels, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\loaddata.py", line 61, in handle
self.loaddata(fixture_labels)
File "C:\Python27\lib\site-packages\django\core\management\commands\loaddata.py", line 91, in loaddata
self.load_label(fixture_label)
File "C:\Python27\lib\site-packages\django\core\management\commands\loaddata.py", line 142, in load_label
for obj in objects:
File "C:\Python27\lib\site-packages\django\core\serializers\json.py", line 81, in Deserializer
six.reraise(DeserializationError, DeserializationError(e), sys.exc_info()[2])
File "C:\Python27\lib\site-packages\django\core\serializers\json.py", line 75, in Deserializer
for obj in PythonDeserializer(objects, **options):
File "C:\Python27\lib\site-packages\django\core\serializers\python.py", line 122, in Deserializer
m2m_data[field.name] = [m2m_convert(pk) for pk in field_value]
django.core.serializers.base.DeserializationError: Problem installing fixture 'C:\Python27\aasoo\content\fixtures\initial_data.json': 'int' object is not iterable
C:\Python27\aasoo>
You should rename get_query_set to get_queryset in SearchManagerMixIn. Can you paste the definition of the class if you need more help.
Error:
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\management\__init__.py", line 459, in execute_manager
utility.execute()
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\management\__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\management\base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\management\base.py", line 232, in execute
output = self.handle(*args, **options)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\management\base.py", line 371, in handle
return self.handle_noargs(**options)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 163, in handle_noargs
collected = self.collect()
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 113, in collect
handler(path, prefixed_path, storage)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 287, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 219, in delete_file
self.storage.modified_time(prefixed_path)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\files\storage.py", line 264, in modified_time
return datetime.fromtimestamp(os.path.getmtime(self.path(name)))
ValueError: timestamp out of range for platform localtime()/gmtime() function
(env) D:\CODE\wamp\www\lezcheung\lezcms>
Anyone know help me?
This looks like it's caused by files being collected by collectstatic having outrageously inaccurate last modified timestamps (like before 1970). Try searching google for tools that allow you to modify your files' last modified dates and change them to something reasonable.
I discoreved.
This is just cause I put some fonts in /static/fonts/ and the django don't accept fonts on Static Folder. So, i changed this files to /media/fonts/.
Worked! :D