I have decided that it was time to move to virtualenv for my django projects. All is working well except one thing. Even though the apps installed with pip into my virtualenv can be imported into my project without issue, any .urls, templates, template tags, etc. in those apps are not found when running the dev server.
I checked my python path in the environment and the site-packages directory with my installs are in the path.
Anyone know what I might be doing wrong?
--- added information ---
Since I am still having issues, I am adding more information to this ticket. I am sure it is something I am doing, just can't figure out开发者_StackOverflow中文版 what it is. Starting with a fresh environment, tested on both ubuntu and osx.
virtualenv --no-site-packages testpjt
Then I use pip to add just django and django smuggler. Here is the requirements text
-e svn+http://code.djangoproject.com/svn/django/trunk#egg=Django
django-smuggler==0.1.1-final
Then I install requirements with pip
pip install -E testpjt -r requirements.txt
Every thing seems to install fine. So I start the virtual environment and make the following changes to files:
source ../bin/activate
Add smuggler to installed apps:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'smuggler',
)
Add admin and smuggler to the urls.py
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include('smuggler.urls')),
(r'^admin/', include(admin.site.urls)),
)
I then sync the db and start the server:
../bin/python manage.py runserver 0.0.0.0:8000
I can go to ip/admin and I get the admin interface.. I go to ip/admin/load (dump, any of the smuggler urls) and I get a 404.
For testing I can enter the django shell and:
from smuggler import urls
and get no errors, so I know they are there.
If I put a copy of smuggler in the base of my project directory it works just fine.
You are activating the virtual environment before running the dev server right?
The issue here might be that you are installing django-smuggler outside the virtual-env.
First activate the virtual-env. Then install django-smuggler in virtual-env and it should work fine.
精彩评论