Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6823045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:44:09+00:00 2026-05-26T21:44:09+00:00

Maybe it’s because I am more comfortable with python over the shell, but I

  • 0

Maybe it’s because I am more comfortable with python over the shell, but I chose to add to my sys.path list in /usr/lib/python[x.x]/sitecustomize.py in this manner:

base = '/home/droogans/py/'

locs = ['foo','django']

for loc in locs:
    sys.path.insert(0, base + loc)

And now I’ve added a try:except block below it, in case I want to test out a template without using the python manage.py shell approach.

try:
    from django.core.management import setup_environ
    from website_foobar import settings
    setup_environ(settings)
except ImportError:
    pass

The DjangoBook has a section, “A special python prompt“, that recommends you do this, but suggests using your .bash_profile shell script for the task. Is there a measurable benefit to utilizing that instead of a sitecustomize.py script? Obviously, I’m already done, so there’ll have to be some kind of compelling evidence for me to google an article on writing shell code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:44:09+00:00Added an answer on May 26, 2026 at 9:44 pm

    Sometimes you are not going to have superuser status on the machine you are using. In such cases you won’t be able to modify /usr, so it would be necessary then to know how to set environment variables in your personal ~/.bashrc or ~/.profile or ~/.bash_profile. (The particular file to use depends on your system).

    It’s not hard to do. All you’d need to add (I think!) is something like

    PYTHONPATH=$HOME/py/foo:$HOME/py/django
    DJANGO_SETTINGS_MODULE=website_foobar.settings
    
    export PYTHONPATH DJANGO_SETTINGS_MODULE
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe I just don't know .NET well enough yet, but I have yet to
Maybe the need to do this is a 'design smell' but thinking about another
Maybe this is a dumb question, but is there any way to convert a
Maybe I'm just thinking about this too hard, but I'm having a problem figuring
Maybe my understanding of agile development isn't as good as it should be, but
Maybe world peace would be easier, but I have a problem with the widths
Maybe this is a dumb question, but I have the following behavior in Visual
Maybe this cannot be done, but please help or suggest how this can be
Maybe that's only possible with SQLITE but is there also a trick to let
Maybe this is a simple question, but I didn't find answer in web. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.