While trying to set up a Cartridge project, I came to the point of creating a database. Here is what I got:
(tezt1)16:06 ~/rifleShop $ python manage.py createdb --noinput
Traceback (most recent call last):
File "manage.py", line 10, in <module>
from settings import PROJECT_ROOT, PROJECT_DIRNAME
File "/home/sanjivj/rifleShop/settings.py", line 437, in <module>
set_dynamic_settings(globals())
File "/home/sanjivj/.virtualenvs/tezt1/local/lib/python2.7/site-packages/mezzanine/utils/conf.py", line 49, in se
t_dynamic_settings
add_to_builtins("mezzanine.template.loader_tags")
File "/home/sanjivj/.virtualenvs/tezt1/local/lib/python2.7/site-packages/django/template/base.py", line 1405, in
add_to_builtins
builtins.append(import_library(module))
File "/home/sanjivj/.virtualenvs/tezt1/local/lib/python2.7/site-packages/django/template/base.py", line 1341, in
import_library
(taglib_module, e))
django.template.base.InvalidTemplateLibrary: ImportError raised loading mezzanine.template.loader_tags: cannot import name find_template_loader
In case it matters, this was on Pythonanywhere, but I got the same result on my laptop, working offline. Also, I did not get this problem with a "plain" Mezzanine project; only with Cartridge.
You're using incompatible versions of Django and Mezzanine.
The current Mezzanine release only supports Django versions earlier than 1.7 - if you need Django 1.7 or later, try installing Mezzanine's source directly from Github, which supports 1.7 and greater.
Note: You can substitute "Mezzanine" above, with "Mezzanine and Cartridge".
Related
I am trying to make a django server for a sociometric badge (https://github.com/HumanDynamics/openbadge-server) for our university's project. The code (and the whole badge) has been done by someone else and I have not myself changed anything, I am simply trying to get it to work. I am able to build the server but when trying to migrate or create a superuser, I get a syntax error. I've been trying to troubleshoot it by myself but I have very limited knowledge of python, django and Ubuntu so I'm probably missing something.
The error implies an error in the line 44 of /usr/local/lib/python2.7/site-packages/pkgconf/init.py but I cannot find the file so I cannot check it. In fact, the whole site-packages folder is empty so I wonder if I have installed modules in a wrong way? The code is written in python2.7 (Which I cannot change as it is not my code) so I also wonder if the python2.7 being EOL could cause issues? It has already broken some parts, mainly how to get some of the dependencies.
The code and docker files used in this project can be found here: https://github.com/HumanDynamics/openbadge-server
The dependency versions should be fine, the Django version should be compatible with Python2.7 and same for other modules. I've tried changing the versions around but to no avail. Down here is the requirement texts
Django==1.8.4
Fabric==1.10.2
django-grappelli==2.7.1
simplejson==3.8.0
MarkupSafe==0.23
django-pipeline==1.5.4
djangorestframework==3.2.3
djangorestframework-expiring-authtoken==0.1.1
pytz==2015.7
python-dateutil==2.5.3
jsonfield==1.0.3
django-controlcenter===0.2.6
# Configuration
django-environ==0.4.1
# Python-PostgreSQL Database Adapter
psycopg2==2.7.3.2
# Unicode slugification
awesome-slugify==1.6.5
# Import and export using the admin tool
# Using tablib 0.12.1. Newer versions break the import-export add-on
tablib==0.12.1
django-import-export==1.0.0
coverage==4.3.1
django-coverage-plugin==1.3.1
Sphinx==1.5.1
django-extensions==1.7.5
Werkzeug==0.11.15
django-test-plus==1.0.16
factory-boy==2.8.1
django-debug-toolbar==1.6
# improved REPL
ipdb==0.10.1
pytest-django==3.1.2
pytest-sugar==0.8.0
This is the error. From my limited knowledge, I'd gather that it doesn't find the files from /usr/local/lib/python2.7/site-packages/ but it is completely empty, the dependencies are either installed locally or to dist-packages. Someone earlier said that it was a python3 problem but nothing should be Python3. Could it also be a docker version problem if the build somehow installs wrong things?
Starting openbadge-server_postgres_1 ... done
Postgres is up - continuing...
Traceback (most recent call last):
File "manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 86, in create
module = import_module(entry)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/site-packages/controlcenter/__init__.py", line 1, in <module>
from .dashboards import Dashboard # NOQA
File "/usr/local/lib/python2.7/site-packages/controlcenter/dashboards.py", line 10, in <module>
from . import app_settings
File "/usr/local/lib/python2.7/site-packages/controlcenter/app_settings.py", line 1, in <module>
from pkgconf import Conf
File "/usr/local/lib/python2.7/site-packages/pkgconf/__init__.py", line 44
class Conf(metaclass=ConfMeta):
^
SyntaxError: invalid syntax
I will provide information to best of my abilities.
Fixed the issue by adding django-pkgconf==0.3.0 to the requirements. While the requirements did not have the package at all, it was still installed (and used) through other packages and it installed version 0.4.0 which does not support Python 2.7.
Weird thing is that I could not find a trace where it was installed if I installed it without having it on requirements so even when I manually installed 0.3.0, it would still use 0.4.0 (despite seemingly not having it installed) so in order to get it to work it had to be installed through the docker build.
I installed ATpy-0.9.7 on my pc successfully and I also have the Python version of "2.7.5".
But when I import atpy I get the following error message:
>>> import atpy
ERROR: ImportError: No module named _sqlite3 [unknown]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "atpy/__init__.py", line 1, in <module>
from .basetable import Table, TableSet, VectorException
File "atpy/basetable.py", line 15, in <module>
from . import registry
File "atpy/registry.py", line 186, in <module>
from . import sqltable
File "atpy/sqltable.py", line 10, in <module>
from . import sqlhelper as sql
File "atpy/sqlhelper.py", line 11, in <module>
import sqlite3
File "/export/aibn84_2/zahra/lib/Python-2.7.5/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/export/aibn84_2/zahra/lib/Python-2.7.5/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
I also installed db_sqlite3.egg-info. I don't know why this error message occurs!
I installed again th python2.7.5 with the following command :
./configure --prefix=$PYTHONPATH
but I also get this error after executing make:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 bsddb185
dbm dl gdbm
imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
How could I run configure in order to install required C libraries?
If you are using a self built version of Python you need to ensure that both the base and the development sqllite3 packages are installed on your system before building Python.
If they are not and, as you said, you do not have superuser privileges, you can download and build sqlite locally, and get your Python build to use that version. This blog post describes how.
According to this question
How can I install sqlite3 to Python?
...you shouldn't have to install anything to get sqlite3 for python. Before I could import atpy I did have to install astropy (which was quite involved). After I did that, everything worked.
I am trying to install Django with Jython.
System - Windows 7, 64bit
Jython - 2.5.4rc1 (installed succesfully)
Django - 1.5 (not yet installed)
When I am in the unpacked Django-1.5 directory and try to run the command line instruction
'jython setup.py install'
I get the error message:
Traceback (most recent call last):
File "setup.py", line 84, in (module)
version = __import__('django').get_version()
File "E:\jython2.5.4rc1\bin\Django-1.5\django\__init__.py", line 6, in get_version
from django.utils.version import get_version
File "E:\jython2.5.4rc1\bin\Django-1.5\django\utils\version.py", line 1
SyntaxError: future feature unicode_literals is not defined
I can imagine that it is something very simple that only an ABSOLUTE NEWBIE could ever get wrong. So we all know what I am :)
Many thanks for any help in taking my first wobbly steps.
Django 1.5 has dropped support for Python 2.5. Therefore, you have to use a Jython 2.7 alpha release if you want to use Django 1.5 with Jython. Please use Django 1.4 if you want to keep using Django on a stable Jython version.
https://docs.djangoproject.com/en/dev/howto/jython/
Sometimes my stupid, reckless and daredevil programming gut gets me to some dangerous places:
I've started a Django 1.4 application with sqlite3 and then moved to mysql, no big deal there. But then I realized that my models fit well with a NoSql model and decided to try MongoDB with django-nonrel wich is a fork of Django 1.3 with support for non-relational databases. the version 1.4 still not ready to use yet.
So, I've branched my repo, created my virtualenv and pipinstalled django-nonrel but when I run ./manage.py shell I got this message
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/marcoslhc/Documents/Proyectos/fontcase/mongoBE/lib/python2.7/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
utility.execute()
File "/Users/marcoslhc/Documents/Proyectos/fontcase/mongoBE/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/marcoslhc/Documents/Proyectos/fontcase/mongoBE/lib/python2.7/site-packages/django/core/management/__init__.py", line 252, in fetch_command
app_name = get_commands()[subcommand]
File "/Users/marcoslhc/Documents/Proyectos/fontcase/mongoBE/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
apps = settings.INSTALLED_APPS
File "/Users/marcoslhc/Documents/Proyectos/fontcase/mongoBE/lib/python2.7/site-packages/django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/Users/marcoslhc/Documents/Proyectos/fontcase/mongoBE/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/Users/marcoslhc/Documents/Proyectos/fontcase/mongoBE/lib/python2.7/site-packages/django/conf/__init__.py", line 139, in __init__
logging_config_func(self.LOGGING)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 776, in dictConfig
dictConfigClass(config).configure()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 562, in configure
'filter %r: %s' % (name, e))
ValueError: Unable to configure filter 'require_debug_false': Cannot resolve 'django.utils.log.RequireDebugFalse': No module named RequireDebugFalse
RequireDebugFalse is new in Django 1.4 (see here and here) and I guess some other underlying magic new in 1.4 would not work either in this new installation. I was wondering if I can migrate back my application to Django 1.3 without doing django-admin.py startproject or django-admin.py startapp.
You can do that, although you probably want to leave the door open to going forward again.
The way I've handled this in the past is, if at all possible, to not go making massive changes to your code. Instead, do what you've already done -- run the code and wait for it to blow up. Identify what the source of the problem is and then do one of the following:
Create a stub that supplies the needed functionality (or at least quietly does nothing),
Back-port the functionality onto your own personal copy of 1.3, or
Monkey-patch the functionality onto an unmodified 1.3. (My recommendation)
Unless you have totally glommed onto some unique new feature in 1.4, you'd be surprised how quickly you can come up with a useable environment. I had one project where the monkey-patch file was only about 100 lines long to retrofit about a dozen features onto an older version.
If you haven't used django 1.4 stuff in your project you could create a 1.3 project and copy the logging settings from there. Then you should be fine.
I'm trying to set up a Django app to run on GAE, and am using the on_production_server test to choose between dev vs. production settings in settings.py.
However, when I run
python manage.py runserver
I get:
Traceback (most recent call last):
File "manage.py", line 11, in <module>
import settings
File "/home/guillaume/myproject/settings.py", line 10, in <module>
from djangoappengine.utils import on_production_server, have_appserver
File "/home/guillaume/myproject/djangoappengine/utils.py", line 18, in <module>
'Error was: %s' % e)
Exception: Could not get appid. Is your app.yaml file missing?
Error was: No module named antlr3
I tried adding the following to settings.py:
import sys
sys.path.append('/usr/local/google_appengine/lib/')
And this line to the very end of .profile:
PATH="$PATH:/usr/local/google_appengine/"
But neither gets rid of the error. I'm really new to working with paths so I'm kind of fumbling around blindly here. Can anyone help?
Python2.5v or 2.7v?
And what about GAE SDK version?
Did you try this?
Saw this question while having the same problem. Solved it by installing antlr 3.1.1 python runtime from Here.