question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wacky installer behavior

See original GitHub issue

How to get a broken virtual environment:

$ mkdir test
$ cd test
$ virtualenv -p python2 .venv
$ source .venv/bin/activate
$ pip install django==1.3.7

If you try to run or make a new project your project will not work well. Because pip collects all non-pythonic django files (images, html, css, js, and files of locale) and installs to the new different folder. For example:

$ find .venv -iname *.css -print
.venv/django/contrib/admin/media/css/login.css
.venv/django/contrib/admin/media/css/base.css
.venv/django/contrib/admin/media/css/widgets.css
.venv/django/contrib/admin/media/css/forms.css
.venv/django/contrib/admin/media/css/dashboard.css
.venv/django/contrib/admin/media/css/ie.css
.venv/django/contrib/admin/media/css/rtl.css
.venv/django/contrib/admin/media/css/changelists.css

The original path according to django archive for these files must be .venv/lib/python2.7/site-packages/django/contrib/admin/media/css/

And if you install django from archive:

$ python Django-1.3.7/setup.py install

Your project will works fine.

Can anybody explain why and how to fix it? P.S. --no-binary doesn’t help (and doesn’t have to)

Environment

  • pip version: 19.1.1
  • Python version: python 2.7
  • OS: Linux dell 5.1.15-arch1-1-ARCH #1 SMP PREEMPT Tue Jun 25 04:49:39 UTC 2019 x86_64 GNU/Linux (Also you can reproduce from Ubuntu 18.04 LTS x86_64)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ak4nvcommented, Jul 12, 2019

Regarding my issue… Django 1.3.7 installed via pip

  1. Can’t find locale files
  2. Can’t find admin media files
  3. Can’t find admin templates

If you’ve got the same just add this code into your settings.py

import os

def abs_path(*x):
    return os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)

PROJECT_ROOT = abs_path()
VIRTUAL_ENV = os.getenv('VIRTUAL_ENV', '.venv')

def find_folders(folder):
    return tuple(os.path.join(root, folder)
                 for root, dirs, files in os.walk(PROJECT_ROOT)
                 if folder in dirs)


LOCALE_PATHS = find_folders('locale')
TEMPLATE_DIRS = find_folders('templates')
ADMIN_MEDIA_ROOT = abs_path(PROJECT_ROOT, VIRTUAL_ENV,
                            'contrib', 'admin', 'media')
0reactions
pradyunsgcommented, Jul 12, 2019

Thanks for filing this and closing this.

A tiny little nit-bit of advice: You should really be using a more modern version of Django and please ask any further Django related queries on a channel where people more directly related to Django would respond - https://www.djangoproject.com/community/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Systems Management : Wacky Installshield Behavior - ITNinja
Hey guys, I have this one application, Avaya Modular Messaging, that is giving me fits during SMS distribution. The install works fine during...
Read more >
Unexplained Windows or software behavior may be caused ...
Cause. This issue may occur when deceptive software, such as spyware that is known as "grayware," is installed on your computer. This kind...
Read more >
BIZARRE Claims - Body Language Experts Reveal The Truth
The Behavior Panel is a group made up of the world's top 4 body language and behavior experts, Scott Rouse, Mark Bowden, Chase...
Read more >
Wacky Wheels - PCGamingWiki PCGW
Weird controller behavior with DOSBox • Link · Open the DOSBox configuration (in the GOG.com version, that's dosbox_wwheels.conf ) · Locate the [joystick]...
Read more >
10 Reasons Your Android is Acting Weird - Clario
If your Android phone won't let you install new apps, randomly fails to open or shuts down existing ones, and spams you with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found