failed to install django-chronograph in django 1.7 - django

I tried to install django-chronograph to django-1.7 for assigning scheduled task in my django web-app.
I followed the instruction as shown here but it gives me the following error when running python manage.py makemigrations or python manage.py syncdb:
user#(none):~/mysite$ python manage.py makemigrations
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 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 23, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/chronograph/admin.py", line 2, in <module>
from django.conf.urls.defaults import patterns, url
ImportError: No module named defaults
Is it django-chronograph not supported by django-1.7?

I've never heard of this package, but if you search for that error you will find that that import path hasn't worked since Django 1.6.
It could be that it's just the PyPI version that's old, and that the master branch works fine. However, the last commit to this package was in March 2013, and there's an open issue on the project's bitbucket page indicating that it fails to work on 1.6, so I doubt it.
In sum, it appears that this package supports neither Django 1.6 nor 1.7.

They already committed a fix, so to get rid of this error, don't go through:
pip install django-chronograph
I've just installed on Django 1.8 without issues (so far..) using:
pip install -e hg+https://bitbucket.org/wnielson/django-chronograph#f561106f6aaab62f2817e08e51c799320fd916d9#egg=django-chronograph

Related

Trying to install Django reversion

I'm trying to setup a Django project but Im getting this:
python2.7 manage.py migrate
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 364, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named reversion
So I'm trying to instal reversion, but I'm getting this error message when trying to installenter code here it:
$sudo pip install django-reversion
Downloading/unpacking django-reversion
Downloading django-reversion-3.0.7.tar.gz (67kB): 67kB downloaded
Running setup.py (path:/tmp/pip_build_root/django-reversion/setup.py) egg_info for package django-reversion
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/django-reversion/setup.py", line 28, in <module>
long_description=read('README.rst'),
File "/tmp/pip_build_root/django-reversion/setup.py", line 19, in read
with open(filepath, "r", encoding="utf-8") as f:
TypeError: 'encoding' is an invalid keyword argument for this function
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/django-reversion/setup.py", line 28, in <module>
long_description=read('README.rst'),
File "/tmp/pip_build_root/django-reversion/setup.py", line 19, in read
with open(filepath, "r", encoding="utf-8") as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/django-reversion
Storing debug log for failure in /home/tirengarfio/.pip/pip.log
I'm on Ubuntu 16.04 and python 2.7.
That Python3-only open() was added with version 3.0.6. Try earlier versions, 3.0.5 or 3.0.4:
pip install django-reversion==3.0.5
or
pip install django-reversion==3.0.4
Django 3 supports python versions 3.6 and above.
Here is the official Django 3.0 release notes

Django can't find package even though in virtualenv

I'm coming into an inherited Django project, so I can't say how it was originally set up. However, pip freeze tells me that django-cms is installed in the virtualenv:
(demo)$ pip freeze
...
django-cms==3.3.0
...
So why when I do anything with, manage.py, do I get an error saying it's not available?
(demo)$
./manage.py shell
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/iscape/sites/demo/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/iscape/sites/demo/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 328, in execute
django.setup()
File "/iscape/sites/demo/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/iscape/sites/demo/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/iscape/sites/demo/local/lib/python2.7/site-packages/django/apps/config.py", line 112, in create
mod = import_module(mod_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named cms
I can also confirm that VIRTUAL_ENV has the correct value in the "activate" script. It's like pip knows what's installed, but Django doesn't.
This is Django1.8, btw, though I don't know how much of a factor that is.
Any ideas? I'm getting nothing out of the stack trace and don't know where else to look.

Python Django manage.py shell Attribute error module 'ast' has no attribute 'AnnAssign'

So I'm working on this test app in Django and i wanted to add some data to my sql tables through the python shell. I ran the following command from the CMD
λ python manage.py shell
Which gave me the following output:
Traceback (most recent call last): File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv) File "C:\Python\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute() File "C:\Python\lib\site-packages\django\core\management\__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options) File "C:\Python\lib\site-packages\django\core\management\base.py", line 335, in execute
output = self.handle(*args, **options) File "C:\Python\lib\site-packages\django\core\management\commands\shell.py", line 99, in handle
return getattr(self, shell)(options) File "C:\Python\lib\site-packages\django\core\management\commands\shell.py", line 35, in ipython
from IPython import start_ipython File "C:\Python\lib\site-packages\IPython\__init__.py", line 55, in <module>
from .terminal.embed import embed File "C:\Python\lib\site-packages\IPython\terminal\embed.py", line 15, in <module>
from IPython.core.interactiveshell import DummyMod, InteractiveShell File "C:\Python\lib\site-packages\IPython\core\interactiveshell.py", line 109, in <module>
_assign_nodes = (ast.AugAssign, ast.AnnAssign, ast.Assign) AttributeError: module 'ast' has no attribute 'AnnAssign'
I'm using Python 3 and Django 2.0.3.
Some things I tried on my own:
I checked that ipython was up to date using pip, my database runs on SQL community server runs and works fine and the Django server itself also runs without issues.
EDIT: I did some more digging AST is part of the standard python library. However i dont find any issues with my python install, any ideas?
EDIT2: Tried reinstalling Ipython, same traceback error.
Alright, so i did a complete reinstall of Django and Mysqlclient through PIP which solved the problem. I now have acess to the django shell.

openstack-dashboard-ubuntu-theme Error while installing package

I'm trying implement elastic search in my Django application.
For that i need to install open JDK-7 in my ubuntu 16.04 system.
While installing i'm getting the following error.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libatk-wrapper-java libatk-wrapper-java-jni openjdk-7-jre
Suggested packages:
openjdk-7-demo openjdk-7-source visualvm icedtea-7-jre-jamvm sun-java6-fonts
fonts-ipafont-gothic fonts-ipafont-mincho fonts-indic
The following packages will be REMOVED:
openstack-dashboard-ubuntu-theme
The following NEW packages will be installed:
libatk-wrapper-java libatk-wrapper-java-jni openjdk-7-jdk openjdk-7-jre
openjdk-7-jre-headless
0 upgraded, 5 newly installed, 1 to remove and 28 not upgraded.
2 not fully installed or removed.
Need to get 0 B/55.9 MB of archives.
After this operation, 77.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 515256 files and directories currently installed.)
Removing openstack-dashboard-ubuntu-theme (2:9.1.0-0ubuntu1) ...
Collecting and compressing static assets...
Traceback (most recent call last):
File "manage.py", line 25, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/openstack-dashboard/openstack_dashboard/settings.py", line 381, in <module>
from openstack_auth import policy
File "/usr/lib/python2.7/dist-packages/openstack_auth/policy.py", line 24, in <module>
from openstack_auth import user as auth_user
File "/usr/lib/python2.7/dist-packages/openstack_auth/user.py", line 18, in <module>
from django.contrib.auth import models
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 94, in __new__
app_config = apps.get_containing_app_config(module)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 239, in get_containing_app_config
self.check_apps_ready()
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
dpkg: error processing package openstack-dashboard-ubuntu-theme (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
openstack-dashboard-ubuntu-theme
E: Sub-process /usr/bin/dpkg returned an error code (1)
I also tried following commands to fix these issues.But it didn't worked
apt-get remove --auto-remove openstack-dashboard-ubuntu-theme
Thanks in advance
I was able to discern in my case it was an issue to do with apache not restarting due to a missing module namely : wsgi
I installed it :
apt-get install libapache2-mod-wsgi
The activated it :
sudo a2enmod wsgi
sudo /etc/init.d/apache2 reload
or
service apache2 restart
The I was able to uninstall the openstack-dashboard-ubuntu-theme:
dpkg --remove --force-remove-reinstreq openstack-dashboard-ubuntu-theme
Hope it helps.

Installation of django-scheduler: $python manage.py runserver returns KeyError: u'__module__'

I installed django-scheduler with pip (https://github.com/llazzaro/django-scheduler) and I edited settings.py as in the tutorial. When I run $python manage.py runserver I got this:
python manage.py runserver
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 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/django_scheduler-0.7.5-py2.7.egg/schedule/models/__init__.py", line 1, in <module>
from schedule.models.calendars import *
File "/usr/local/lib/python2.7/dist-packages/django_scheduler-0.7.5-py2.7.egg/schedule/models/calendars.py", line 110, in <module>
class Calendar(with_metaclass(ModelBase, *get_model_bases())):
File "/usr/lib/python2.7/dist-packages/six.py", line 617, in with_metaclass
return meta("NewBase", bases, {})
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 71, in __new__
module = attrs.pop('__module__')
KeyError: u'__module__'
I tried to reinstall Python (2.7), Django (1.7) and the app. I need a calendar app to my project and this seems the most complete.
Thanks.
I had this same issue. It turned out to be a problem with the version of python's six I had installed. I was using six version 1.6.1, and when I upgraded to version 1.9.0 it took care of this error. Run:
pip-2.7 install --upgrade six
run this script using djago-getversions.py
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
----------------------------------------------------
check your django installed versions
after that compare or reinstall like these versions:
please check your this version:
[
'adium-theme-ubuntu==0.3.4',
'apt-xapian-index==0.45',
'chardet==2.0.1',
'colorama==0.2.5',
'command-not-found==0.3',
'debtagshw==0.1',
'defer==1.0.6',
'dirspec==13.10',
'django-classy-tags==0.6.1',
'django-cms==3.0.12',
'django-mptt==0.6.1',
'django-sekizai==0.8.1',
'django-treebeard==3.0',
'django==1.6.1',
'djangocms-admin-style==0.2.5',
'djangocms-link==1.5',
'djangocms-snippet==1.4',
'djangocms-text-ckeditor==2.4.3',
'dnspython==1.11.1',
'duplicity==0.6.23',
'html5lib==0.999',
'httplib2==0.8',
'iniparse==0.4',
'lockfile==0.8',
'lxml==3.3.3',
'mercurial==2.8.2',
'mysql-connector-python==1.1.6',
'mysql-python==1.2.3',
'mysql-utilities==1.3.5',
'oauthlib==0.6.1',
'oneconf==0.3.7',
'pam==0.4.2',
'paramiko==1.10.1',
'pexpect==3.1',
'pillow==2.3.0',
'pip==7.1.0',
'piston-mini-client==0.7.5',
'pycrypto==2.6.1',
'pycups==1.9.66',
'pycurl==7.19.3',
'pygments==1.6',
'pygobject==3.12.0',
'pyopenssl==0.13',
'pyserial==2.6',
'pysmbc==1.0.14.1',
'pysqlite==2.6.3',
'python-apt==0.9.3.5ubuntu1',
'python-debian==0.1.21-nmu2ubuntu2',
'pyxdg==0.25',
'reportlab==3.0',
'requests==2.2.1',
'sessioninstaller==0.0.0',
'setuptools==3.3',
'six==1.5.2',
'software-center-aptd-plugins==0.0.0',
'south==1.0.2',
'system-service==0.1.6',
'tortoisehg==2.10',
'twisted-core==13.2.0',
'twisted-web==13.2.0',
'unity-lens-photos==1.0',
'urllib3==1.7.1',
'version==0.1.1',
'virtualenv==13.0.1',
'wheel==0.24.0',
'wxpython-common==2.8.12.1',
'wxpython==2.8.12.1',
'xdiagnose==3.6.3build2',
'youtube-dl==2015.7.7',
'zope.interface==4.0.5'
]