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

  • Home
  • SEARCH
  • 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 8098323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:02:48+00:00 2026-06-05T22:02:48+00:00

I understand how to create a virtualenv, activate that virtualenv, and then install django

  • 0

I understand how to create a virtualenv, activate that virtualenv, and then install django while the virtualenv is activated. Ex:

virtualenv ~/narnia
source ~/narnia/bin/activate
pip install django

From what I understand, when you “activate” a virtual environment it just changes some path variables while you’re in a shell, nothing more. So when django is installed with pip while narnia is activated, it simply installs things into locations relative to ~/narnia instead of relative to /usr (ex. ~/narnia/lib/python2.6/site-packages instead of /usr/lib/python2.6/site-packages).

And now let’s say I want to create a django project with that virtualenv. I don’t even have to be activated, correct? I could just do:

deactivate
cd ~
narnia/bin/django-admin.py startproject myproject

So, if I have a web server set up with “myproject”…how is that django project tied to the narnia virtualenv at this point? Won’t the system path variables simply be the normal systemwide python paths? How does “myproject” know to use the narnia environment?

I am a little confused on how that works. Any help is appreciated.

Thanks!

  • 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-06-05T22:02:51+00:00Added an answer on June 5, 2026 at 10:02 pm

    Web servers typically have a way to configure their Python use. You can set environment variables, paths, and so on. Use these tools to point to the virtualenv.

    For example, in my Apache httpd.conf:

    WSGIDaemonProcess myapp processes=2 threads=12 python-path=/home/nedbat/webapps/myapp/server:/home/nedbat/webapps/myapp/lib/python2.7
    WSGIProcessGroup myapp
    WSGIRestrictEmbedded On
    WSGILazyInitialization On
    WSGIScriptAlias / /home/nedbat/webapps/myapp/myapp.wsgi
    

    and I have an myapp.wsgi file:

    import os
    import site
    import sys
    
    VE = '/home/nedbat/webapps/myapp/ve'
    
    site.addsitedir(VE + '/lib/python2.7/site-packages')
    
    os.environ['DJANGO_SETTINGS_MODULE'] = 'prod_settings'
    os.environ['USE_PYPY'] = 'y'
    os.environ['TMPDIR'] = '/home/nedbat/webapps/myapp/tmp'
    
    from django.core.handlers.wsgi import WSGIHandler
    
    application = WSGIHandler()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just upgraded from SnowLeapord to Lion and now cannot create virtualenvs. I understand
I understand that we need to create MXML file to define a view. Suppose
I'm trying to understand if it's possible to create a set of variables that
I'm trying to create a simple example to understand how to store then retrieve
I understand that I can call ToString().IndexOf(...), but I don't want to create an
I understand how to create a struct that can be used to access an
Here is the code that will help you understand my question: create table con
I understand how to create type traits and then specialise for a particular class,
Currently I understand I can create a XML Layout and pass that to setContentView(...),
I've installed UML plugin but I cant understand how create UML automatically

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.