The sourced shell script is was talking about would be something like this:

 $ cat setup_settings
PROJECT=inventory
SITE=inventory
DJANGO_APPS=${HOME}/dev/django_apps/apps
DJANGO_HOME=${DJANGO_APPS}/${PROJECT}
DJANGO_PATH=${DJANGO_HOME}/django/bin
export PATH=${DJANGO_PATH}:${PATH}
export PYTHONPATH=${DJANGO_HOME}:${DJANGO_APPS}/site-packages
export DJANGO_SETTINGS_MODULE=${SITE}.settings
unset DJANGO_HOME
unset DJANGO_PATH
unset DJANGO_APPS

The above is for a yet to be published open source inventory
application I am writing. It should be put in the route or your
project (see below) and adjust the path to your liking. You would run
this like so:

$ . setup_settings
or
$ source setup_settings

There is a space between the dot and the script. This is Linux/UNIX
only like I said with windows you need to put the proper path into
your system path manually. The Mac will be the same as Linux in this
case.

I run a variation of this script just before I do any work on a Django
project. Without something like this you won't be able to do much. In
the above and below examples the PROJECT and SITE have the same
meaning. I tend to use the same name for both, but they don't need to
be. The above script will work as is with the below directory layout.
This script is only used while you are working on your project it has
nothing to do with mod_wsgi or anything running in a production
environment.

My project layout follows the path tree below:

# |-- Django-x.x.x  (BASE_DJANGO_PATH)
# `-- apps  (BASE_PACKAGE_PATH)
#     |-- site-packages  (SITE_PACKAGES)
#     `-- <project>  (BASE_SITE_PATH)
#         |-- db
#         |-- logs
#         |-- apache  (APACHE_CONF)
#         |   |-- app.wsgi
#         |   `-- <project>.conf
#         `-- <site>
#             |--__init__.py
#             |--settings.py
#             |--urls.py
#             '-- <app>
#                 |--views.py
#                 |--models.py
#                 `--tests.py

Using the above layout lets you have many projects all using the same
Django code. You just start a new project in the apps dir.

I hope this helps.

~Carl


On Mon, Jul 5, 2010 at 9:51 PM, Bradley Hintze
<[email protected]> wrote:
> Carl,
>
> What do you mean by
>
> 'It needs to be put in your path. This is usually done by sourcing a
> shell script before you start working.'
>
> ????
>
> Thanks,
> Bradley
>
> On Fri, Jun 25, 2010 at 5:33 PM, Carl Nobile <[email protected]> wrote:
>> django-admin.py is in Django-x.x.x/django/bin after expanding the
>> zip/tarball, etc.
>>
>> It needs to be put in your path. This is usually done by sourcing a
>> shell script before you start working. If you are using windows you
>> will need to put it permanently in your path.
>>
>> ~Carl
>>
>> On Fri, Jun 25, 2010 at 4:37 PM, Bradley Hintze
>> <[email protected]> wrote:
>>> Your right in avoiding Django. I installed it and can't follow their
>>> tutorial because django-admin.py is no where on my machine. haha
>>> Pylons it is I guess.
>>>
>>> On Fri, Jun 25, 2010 at 3:38 PM, Raoul Snyman <[email protected]> 
>>> wrote:
>>>> On 25 June 2010 20:59, Bradley Hintze <[email protected]> wrote:
>>>>> I just talked to him. He just doesn't know about python frameworks.
>>>>> What frame work would you (and all reading this) recommend? Preferably
>>>>> one with a startup tutorial that doesn't requie a degree in CS.
>>>>
>>>> Personally, I use Pylons[0]. It's not one of those "do everything
>>>> under the sun" frameworks, it is more geared towards providing you
>>>> with a smaller, more flexible platform to work on, but it does mean
>>>> that you might need to write a bit more boilerplate code. If you would
>>>> prefer a system that comes with the kitchen sink included, you can
>>>> look at Django[1] or TurboGears 2.x[2]. Another, even simpler and less
>>>> structured than Pylons WSGI framework is Werkzeug[3].
>>>>
>>>> Personally I steer clear of Django because it's inflexible, TurboGears
>>>> because I have to write too much in places where I would expect it to
>>>> just work, and Werkzeug because it is not structured enough for me.
>>>> Each framework has it's own pro's and cons.
>>>>
>>>> [0] http://pylonshq.com/
>>>> [1] http://www.djangoproject.com/
>>>> [2] http://turbogears.org/
>>>> [3] http://dev.pocoo.org/projects/werkzeug/
>>>>
>>>> --
>>>> Raoul Snyman
>>>> B.Tech Information Technology (Software Engineering)
>>>> E-Mail:   [email protected]
>>>> Web:      http://www.saturnlaboratories.co.za/
>>>> Blog:      http://blog.saturnlaboratories.co.za/
>>>> Mobile:   082 550 3754
>>>> Registered Linux User #333298 (http://counter.li.org)
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "modwsgi" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to 
>>>> [email protected].
>>>> For more options, visit this group at 
>>>> http://groups.google.com/group/modwsgi?hl=en.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Bradley J. Hintze
>>> Graduate Student
>>> Duke University
>>> School of Medicine
>>> 801-712-8799
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "modwsgi" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group at 
>>> http://groups.google.com/group/modwsgi?hl=en.
>>>
>>>
>>
>>
>>
>> --
>> -------------------------------------------------------------------------------
>> Carl J. Nobile (Software Engineer)
>> [email protected]
>> -------------------------------------------------------------------------------
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "modwsgi" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/modwsgi?hl=en.
>>
>>
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>
> --
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/modwsgi?hl=en.
>
>



-- 
-------------------------------------------------------------------------------
Carl J. Nobile (Software Engineer)
[email protected]
-------------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to