When I execute python manage.py runserver command for my django_test projects I get following error:
System check identified no issues (0 silenced).
June 14, 2015 - 20:43:03
Django version 1.8.2, using settings 'django_test.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 49, in execute
super(Command, self).execute(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 88, in handle
self.run(**options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 97, in run
autoreload.main(self.inner_run, None, options)
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 323, in main
reloader(wrapped_main_func, args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 289, in python_reloader
reloader_thread()
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 265, in reloader_thread
change = fn()
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 190, in inotify_code_changed
update_watch()
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 184, in update_watch
wm.add_watch(path, mask)
File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 1903, in add_watch
exclude_filter)
File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 1822, in __add_watch
wd = self._inotify_wrapper.inotify_add_watch(self._fd, path, mask)
File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 150, in inotify_add_watch
return self._inotify_add_watch(fd, pathname, mask)
File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 245, in _inotify_add_watch
return self._libc.inotify_add_watch(fd, pathname, mask)
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected CString instance instead of c_char_Array_64
I have never had this problem before and my code always worked fine until I moved the project from one laptop to the other and can not execute it here.
Originaly, it worked fine but the system crashed and it is first time when I am trying to run the code on the new machine. I use virtualenv so I would expect everything to work smoothly but it does not ...
Is it a problem with python itself ?
It looks like you're running against the system version of python on the new laptop, rather than the virtualenv, so it is probably a different version. You can check this by looking at the version of Python on the virtualenv in the old laptop and the new laptop with python --version - I've seen this error happen in this case to people before.
Your best bet is to create a new virtualenv on the new laptop, and reinstall your packages (hopefully, you have a requirements.txt handy). If you need the same version of Python on the new laptop, you'll have to explore getting that version installed on your new laptop (do not overwrite the system version!), and pointing your virtualenv to the install. Good luck.
Related
i'm running with this error when running a server. I changed my code directory name before and so earlier i faced the running problem as well. However, it's fixed after changing the name as well in the settings.py, manage.py, and others that might have the old name. I also install the Django, pillow, and psycopg2 again because it told me when trying to run the server in the command prompt. Now, i faced this problem. It says that.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run
self.check_migrations()
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\core\management\base.py", line 459, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\db\migrations\executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\db\migrations\loader.py", line 53, in __init__
self.build_graph()
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\db\migrations\loader.py", line 255, in build_graph
self.graph.validate_consistency()
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\db\migrations\graph.py", line 195, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\db\migrations\graph.py", line 195, in <listcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "C:\Users\karen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\django\db\migrations\graph.py", line 58, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration account.0011_auto_20201117_0027 dependencies reference nonexistent parent node ('auth', '0013_proxyuser')
Can someone help me to find where's the problem? I am still a beginner and i really hope i can get a solution towards this error. Thankyou in advance.
This issue arose due to improper migrations. I would suggest you drop the migration file and try again.
Am trying to apply a migration to a new database but I keep getting this error, I have deleted all migration files in my old database and also files in the apps. when I tried applying migrations to a new database or running python manage.py runserver then I get this error..? I wonder what might be the problem. am using Django 3.1.1
E:\All django project\Real-Estate-Django-Web-App-master>manage.py migrate
Traceback (most recent call last):
File "E:\All django project\Real-Estate-Django-Web-App-master\manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Python38\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python38\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python38\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\Python38\lib\site-packages\django\core\management\base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Python38\lib\site-packages\django\core\management\commands\migrate.py", line 92, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "C:\Python38\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:\Python38\lib\site-packages\django\db\migrations\loader.py", line 53, in __init__
self.build_graph()
File "C:\Python38\lib\site-packages\django\db\migrations\loader.py", line 255, in build_graph
self.graph.validate_consistency()
File "C:\Python38\lib\site-packages\django\db\migrations\graph.py", line 195, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "C:\Python38\lib\site-packages\django\db\migrations\graph.py", line 195, in <listcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "C:\Python38\lib\site-packages\django\db\migrations\graph.py", line 58, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0013_user_following dependencies reference nonexistent parent node ('account', '0003_contact')
Well! I was finally able to fix this problem by first uninstalling Django on my virtual env and then redo the installation, but the problem had still persisted, so I just followed my intuition by deleting the whole virtual env, I did the installation of virtualenv and then installed Django and it worked, perfectly. Thank you to all who had tried to help, I really appreciated your answers.
The auth.0013_user_following migration requires the 0003_contact migration which is missing.
Try removing all migrations from all apps and set a new database.
Based on the solution provided by Abubakari UmarblacKrussain Uma, I noticed that packages linked to my virtual environment file were missing/corrupted. When I checked it against my requirements.text file, I noticed that the Django package was replaced by django 2.2.27 (django lowercase), and an entry -jango 3.1.3 was added. I manually edited the requirements.txt file to remove the -jango 3.1.3 entry and replace the django 2.2.27 with Django 3.1.3 and reloaded the virtual environment from requirements.txt. This resolved the error. For good measure I re-generated the requirements.txt file for the virtual environment.
I'm trying to develop and deploy django app on azure web apps.
While following the tutorial on azure website, after cloning the basic project to my local machine (using git) and creating the virtual environment, I'm trying to run the createsuperuser commend, and getting this error:
C:\Users\tutzy\Desktop\newtest\amir1>env\scripts\python manage.py createsuperuser
Traceback (most recent call last):
File "manage.py", line 17, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\core\management\__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 52, in execute
return super(Command, self).execute(*args, **options)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\core\management\base.py", line 413, in execute
translation.activate(saved_locale)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\utils\translation\__init__.py", line 154, in activate
return _trans.activate(language)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\utils\translation\trans_real.py", line 216, in activate
_active.value = translation(language)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\utils\translation\trans_real.py", line 205, in translation
_translations[language] = DjangoTranslation(language)
File "C:\Users\tutzy\Desktop\newtest\amir1\env\lib\site-packages\django\utils\translation\trans_real.py", line 118, in __init__
raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE)
IOError: No translation files found for default language en-us.
It seems that your issue was similar with the other SO thread No translation file found for domain 'django' if you clone the Azure offical sample for Django like this. There is a *.mo line at the 49th line of .gitignore file. Please try to add the missing .mo file and do the createsupersuer operation again.
Hope it helps.
Environment :
python 2.7.10
django 1.8.6(copied from site-package folder)
I copied the django distribute into my project folder.
Thinking it will work well
It works perfectly in one of my machine, but throw an error below in another one
Traceback (most recent call last):
File "manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "cmdb_lib/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "cmdb_lib/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "cmdb_lib/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "cmdb_lib/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "cmdb_lib/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "cmdb_lib/django/core/management/base.py", line 458, in execute
translation.activate(saved_locale)
File "cmdb_lib/django/utils/translation/__init__.py", line 146, in activate
return _trans.activate(language)
File "cmdb_lib/django/utils/translation/trans_real.py", line 222, in activate
_active.value = translation(language)
File "cmdb_lib/django/utils/translation/trans_real.py", line 206, in translation
_translations[language] = DjangoTranslation(language)
File "cmdb_lib/django/utils/translation/trans_real.py", line 115, in __init__
self._init_translation_catalog()
File "cmdb_lib/django/utils/translation/trans_real.py", line 153, in _init_translation_catalog
translation = self._new_gnu_trans(localedir, use_null_fallback)
File "cmdb_lib/django/utils/translation/trans_real.py", line 136, in _new_gnu_trans
fallback=use_null_fallback)
File "/usr/local/lib/python2.7/gettext.py", line 472, in translation
raise IOError(ENOENT, 'No translation file found for domain', domain)
IOError: [Errno 2] No translation file found for domain: u'django'
But in my settings.py I set LANGUAGE_CODE = 'en-us' as default!
How could this throw an error?
I tried to pip install django, problem solved ,but I still want to include the django package in my project.
How can I achieve this?
I think I got the solution , my .gitignorefile ignored the .mo file , I added it and everything 's OK now
If you are using git, check your .gitignore file and comment*.mo
add the missing .mofile ,and things will be good
Like most other Mac/MySQL users with current versions of OS X, I went through the normal issues of getting Python, MySQL and MySQLdb (MySQL-Python) playing nicely together. That has been working for some time, but I'd like to use Aptana for debugging my work Django projects and when I try running either the debugger or running a project, I'm getting the dreaded "mach-o" error.
The interesting thing is that I've configured Aptana to use the same python I'm using (confirmed with a "which python" both within and outside of Aptana), and I've confirmed that the python that's being invoked by Aptana is 32-bit as it should be (same as system terminal reports). Also, when I use the Terminal in Aptana, using the interactive python shell I'm able to successfully 'import MySQLdb'. So I'm stumped.
Under arguments I'm adding this to program arguments per instructions:
runserver 8081 --noreload
But that shouldn't affect anything AFAIK. I'm at a loss of what to do next. Here is the error that Aptana is throwing when I try to launch:
pydev debugger: starting
Validating models...
Traceback (most recent call last):
File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1392, in <module>
debugger.run(setup['file'], None, None)
File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1085, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/Users/my/path/project/manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 67, in handle
self.run(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 78, in run
self.inner_run(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
from django.db import models, connection
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 33, in load_backend
return import_module('.base', backend_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): no suitable image found. Did find:
/Library/Python/2.7/site-packages/_mysql.so: mach-o, but wrong architecture
Any ideas?
Take a look at: How do I force Python to be 32-bit on Snow Leopard and other 32-bit/64-bit questions on ways to configure Python to run in 32 bits (VERSIONER_PYTHON_PREFER_32_BIT environment variable seems a good choice).
Or maybe:
Troubles with PyDev and external libraries in OS X