I am following the Neo4django manual: http://neo4django.readthedocs.org/en/latest/auth.html
and trying to setup Admin's interface. I am working under Mac OS X.
Before I started setting up this interface, I had my server running and everything worked. After I made the indicated changes, the server stopped with the error: Error: No module named contenttypes.
If I disable the contettypes line, I get the error Error: No module named admin.
In my settings.py file:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'polls',
'mysite',
'neo4django.admin',
'neo4django.contenttypes',
)
In urls.py:
from django.conf.urls import patterns, include, url
from neo4django import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)
In admin.py:
from neo4django import admin
from .models import Person
class PersonAdmin(admin.ModelAdmin):
pass
admin.site.register(Person, PersonAdmin)
Could please someone give me correct instructions for setting up the admin's page?
I suggest you throw away the entire tutorial for the moment and install neo4django with pip install -e git+https://github.com/scholrly/neo4django/#egg=neo4django. Also check the github https://github.com/scholrly/neo4django and when installing Django, don't install the latest version but the 1.5.4 version with pip install django==1.5.4
Also, install the 1.9.4 version of neo4j and not the 2.0 version.
If for any reason you find neo4django a bit complicated or not mature enough then you can try the py2neo library (not an ORM) or neomodel (https://github.com/robinedwards/neomodel)
Related
I want to have charts in the admin panel,
I installed the django-admin-charts package,
Which said add these to settings.py
INSTALLED_APPS = (
'admin_tools_stats', # this must be BEFORE 'admin_tools' and 'django.contrib.admin'
'django_nvd3',
)
But after adding it, it gives this error:
ImportError: cannot import name 'smart_text' from 'django.utils.encoding' (E: \ test1 \ venv1 \ lib \ site-packages \ django \ utils \ encoding.py)
I searched but didn't find much about smart_text!
Maybe it has a problem with Django version 4 or Python version 3.10.3?
This is because django-admin-charts needs smart_text and in django 4 smart_text is removed from the utils/encoding so the better way to resolve this issue is to add this code in your settings.py file
import django
from django.utils.encoding import smart_str
django.utils.encoding.smart_text = smart_str
I digged around a little and the problem seems to be the Django version. smart_text function is not present in the django/utils/encoding.py file. I downgraded from 4.0.2 to 3.2.13, set PyMemcacheCache as the default cache in settings.py and it works. In my case downgrading is not acceptable as Django. 3.2.13 doesn't support redis cache, but it might help you. Let's hope that django-admin-charts will add suport for Django 4.0.
I got this error when we switched from Django 2.2 to Django 4 version.
There were a library which was not upgraded. I found this out by searching the usage of "django.utils.encoding import smart_text" statement under the project scope.
The issue resolved once I upgraded the django-wkhtmltopdf library from 3.3.0 to 3.4.0.
Check for any dependent libraries and upgrade as above to fix the issue.
I have been using a google colab template for iterative LQR that uses the Pydrake, however, it seems like the code repository is removed and I can't reinstall it on google Colab:
try:
import pydrake
import underactuated
except ImportError:
!curl -s https://raw.githubusercontent.com/RussTedrake/underactuated/master/scripts/setup/jupyter_setup.py > jupyter_setup.py
from jupyter_setup import setup_underactuated
setup_underactuated()
# Setup matplotlib backend (to notebook, if possible, or inline).
from underactuated.jupyter import setup_matplotlib_backend
plt_is_interactive = setup_matplotlib_backend()
File "/content/jupyter_setup.py", line 1
404: Not Found
^
SyntaxError: invalid syntax
I tried clicking this link https://raw.githubusercontent.com/RussTedrake/underactuated/master/scripts/setup/jupyter_setup.py, and the page is not found... everything was working fine yesterday
Sorry. You're correct... I updated it this morning, and don't have a good deprecation policy in place on that repo, and this setup script is two versions ago. The path you want is https://raw.githubusercontent.com/RussTedrake/underactuated/master/setup/jupyter_setup.py
(remove the script from the directory). But if you look at that file, you'll see that even that is pointing to an updated setup script which you might want to point to.
This is actually all good news... we are on the path to a much better solution. You can now just pip install drake on colab (see the drake installation guide). Once I land the pip install underactuated (probably in time for my Spring offering of the class), then all of that nasty setup will be gone.
Hi
I created my own package, myOwnLib. I made a link from /path/to/anaconda3/lib/python3.7/site-packages which point to my package, following this : Anaconda: Permanently include external packages (like in PYTHONPATH).
It works perfectly when I don't activate any environment. However, When i "conda activate" an environment, I cannot access to the package anymore and receive the message :
"No module named 'myOwnLib'"
I can thus link this library with doing the same action /path/to/.conda/envs/previous/lib/python3.7/site-packages/ , but it becomes redundant.
Is there a more generic way to link modules with anaconda?
Thanks in Advance
action attempted:
1) conda develop "/path/to/lib", as suggested here : How to add folder to search path for a given Anaconda environment?
With a deeper investigation, I notice that conda develop works perfectly IF you use it outside the environnement. Being Inside one don't offer the opportunity to do global changes on How conda manage your Python libs.
Be Carefull: I notice that I cannot use conda develop without having installing pip with conda before ( conda install pip) because conda install pip seems to create lot's of files such as lib, which is needed. Otherwise, you get a message that tells you that it cannot find : path/to/your/env/lib/python3.7/site-packages/conda.pth
Could someone please post the maven dependencies needed to run the stardog 2.1.3 client examples? These critical ones keep coming up undefined
import com.complexible.common.openrdf.OpenRdfIO;
import com.complexible.common.protocols.server.Server;
import com.complexible.stardog.Stardog;
Server and Stardog are in the ${STARDOG}\server directory of the distribution; these are not installed by the maven install script because they're server dependencies and normally not needed in a client application. The complete end-to-end examples, because they include both client & server code, require both sets of dependencies.
The OpenRdfIO class no longer exists, you are using out of data code. If you use the version of the example in the distribution, it will have the correct class name.
I am trying to use Twitter API, I followed directions of http://code.google.com/p/python-twitter/
I installed all the required items, when i test it I get 17 errors.
When i try to import twitter it gives me:
File "C:\Python27\lib\site-packages\twitter.py", line 65, in <module>
import oauth2 as oauth
ImportError: No module named oauth2
I have looked at various questions on this topic, but none of them work for me or maybe because I am doing something wrong. Very lost since it seems i installed all the right files and etc.
Using easy_install bypassed all the problems I experienced with dependencies and installation
Do you have oauth2 installed in your python environment?
http://pypi.python.org/pypi/oauth2/
Perhaps also look into the python-oauth2 package for your OS? (Ubuntu | Debian | Fedora)