Virtualenv and Django apps go poorly together

I decided it was time to upgrade to virtualenv for my django projects. Everything works well, except for one. Despite the fact that applications installed with pip in my virtualenv can be imported into my project without any problems, any .urls, templates, template tags, etc. In these applications not found when starting the dev server.

I checked my python path in the environment and the package sites directory with my settings is in the path.

Does anyone know what I can do wrong?

--- added information ---

Since I still have problems, I am adding additional information to this ticket. I am sure that this is what I am doing, I just canโ€™t understand what it is. Starting with a fresh environment, it is tested on both ubuntu and osx.

virtualenv --no-site-packages testpjt

Then I use pip to add only 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 set the requirements using pip

pip install -E testpjt -r requirements.txt

Everything seems to be fine. Therefore, I start the virtual environment and make the following changes to the files:

source ../bin/activate

Add counterparty to installed applications:

    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 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)),
    )

Then I sync 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's urls) and I get 404.

For testing, I can introduce a django shell and:

from smuggler import urls

and do not get errors, so I know that they are.

If I put a copy of the smuggler in the database of my project directory, it will work fine.

+3
source share
2

dev ?

0

, django-smuggler env.

virtual-env. django-smuggler virtual-env, .

0

Source: https://habr.com/ru/post/1773399/


All Articles