Re: Developing on Apache w/ mod_python

2009-06-21 Thread gte351s

> Don't use:
>   
> and use:
>   

Works like a charm. I now remember reading it and then it blanked out.
Thanks!

Shilo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Developing on Apache w/ mod_python

2009-06-18 Thread gte351s

Graham - Great post, I'll give mod_wsgi a try. Thanks.

And thanks for all the replies. Here's the configuration file I ended
up
using, which worked (kinda):

#
FILE--

LoadModule python_module /usr/lib/apache2/modules/mod_python.so


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['/home/gte351s/dev/django'] + sys.path"


#/
FILE-

Just to make it clear for someone new to Django who reads this and
doesn't have
a clue (like me) on the details of the setup - my actual application
lies
under /home/gte351s/dev/django/mysite (that's the root), and I suppose
that's why the PythonPath needs to point one level above it. Once I
restarted
apache, I was able to access the app through http://localhost/mysite/

A couple of things I noted:
1. I had to explicitly write down the trailing slash in the url, or
I'd get
   an URLconf error saying the address was not found. In other words,
I had
   to type http://localhost/mysite/some-path/ to access r'^some-path/
$'
   whereas on the Django built in server, typing the address w/o the
trailing
   slash words just fine: http://localhost/mysite/some-path
   This could be just some configuration error on my part, I'm a real
newb.

2. I had some permission errors using Mako templates, but I think that
was b/c
   I didn't explicitly give read permissions to apache on the
django_mako dir.
   I didn't dig too deep there, but this should be an easy fix.

Thanks,
Shilo.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Developing on Apache w/ mod_python

2009-06-16 Thread gte351s

Gabriel - thanks for the quick response.
Sorry for the delay in answering, I was away for a bit :)

I had some issues with the setup, but I think I'll
put it on hold for a bit and use the django built-in
dev-server for now.

Many thanks!
shilo

On Jun 15, 8:47 pm, "Gabriel ."  wrote:
> Hi,
>
> This a test conf with mod_python:
>
> 
>     ServerName py.banshee.lnx
>     DocumentRoot "/home/www/python"
>     ErrorLog /var/log/apache2/cash-error_log
>     CustomLog /var/log/apache2/cash-out_log combined
>
>     
>          SetHandler mod_python
>          PythonHandler django.core.handlers.modpython
>          SetEnv DJANGO_SETTINGS_MODULE pyCash.settings
>          PythonOption django.root /pyCash
>          PythonDebug Off
>          PythonPath "['/home/www/python','/home/www/python/pyCash'] + 
> sys.path"
>          PythonInterpreter pyCash
>     
>
>     Alias /media "/home/www/python/pyCash/pages/media"
>     Alias /admin_media "/home/www/python/pyCash/admin_media"
>
>     
>         SetHandler None
>     
>
>     
>         SetHandler None
>     
>
>     
>         SetHandler None
>     
>
>     
>             Options None
>             AllowOverride FileInfo
>             Order allow,deny
>             Allow from all
>     
>
> 
>
> The project is pyCash an is located at /home/www/python
>
> In my case, I have a symlink call admin_media in my application path
> pointing to the correct crontib path.
>
> Modify it to serve your needs.
>
> --
> Kind Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Developing on Apache w/ mod_python

2009-06-15 Thread gte351s

Hello,

I'm very new to Django and trying to configure apache to work
with the tutorial application. I installed mod_python and
configured httpd.conf to look like this:

# mod python
LoadModule python_module /usr/lib/apache2/modules/mod_python.so
NameVirtualHost *:80

ServerName django.test
DocumentRoot "/home/gte351s/dev/django/mysite"
PythonPath "['/home/gte351s/dev/django/mysite',
   '/usr/local/lib/python2.6/dist-packages/django'] +
sys.path"
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On



I have nothing else in that file.

When I point the browser to  http://localhost/time/
I get a mod_python error:
==Hello,

I'm very new to Django and trying to configure apache to work
with the tutorial application. I installed mod_python and
configured httpd.conf to look like this:

# mod python
LoadModule python_module /usr/lib/apache2/modules/mod_python.so
NameVirtualHost *:80

ServerName django.test
DocumentRoot "/home/gte351s/dev/django/mysite"
    PythonPath "['/home/gte351s/dev/django/mysite',
   '/usr/local/lib/python2.6/dist-packages/django'] +
sys.path"
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On



I have nothing else in that file.

When I point the browser to  http://localhost/time/
I get a mod_python error:
==
ImportError: Could not import settings 'mysite.settings'
(Is it on sys.path? Does it have syntax errors?): No module
named mysite.settings
==
This is obviously a configuration error, but I'm not sure how to
set up apache to properly find the django app. I'd appreciate any
help on this - thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GHRML Documentation

2009-06-15 Thread gte351s

> It's a generic templating language, it's not particularly geared toward HTML.
> It's no HAML (you'll still get to write all the HTML yourself), but writing
> custom tags is much easier than with Django. Also, it compiles templates to
> Python code, which makes it reaaally fast.

fast is always good.

> The issue is that views of third-party apps will use Django's stock
> render_to_response, which will use Django's standard templating system,
> which will mean you'll get to maintain templates in two different templating
> languages.
>
> If you don't need third-party apps, this is not a problem (though it removes a
> lot of Django's appeal in my opinion).

Not sure yet, I'm just playing with it - but it's probably safe to
assume
I will someday in the future. Plus the GHRML page wasn't updated in
about 13
months... So it's probably dead.

Thanks,
Shilo.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GHRML Documentation

2009-06-14 Thread gte351s

kg - Nothing special about it I don't like, it's just that I find the
HAML/GHRML
syntax very clean and readable. It's a matter of taste, I suppose :)

Emm - I've looked at Mako, though it doesn't look too far off from
normal
template HTML **at first glance** (I'm sure I've barely skimmed the
surface).

I've played a bit with GHRML and saw the problems you were talking
about with
render_to_response. This was a relatively easy fix (I'm no expert). I
just
used this in my views and settings:

# views.py ###
from django.shortcuts import render_to_response as render_normal
## import ghrml
from ghrml.ghrml_django import render_to_response as render_ghrml

def hello_normal(request):
 name = 'django template'
 return render_normal('normal.html', { 'name' : name })

def hello_ghrml(request):
 name = 'ghrml template'
 return render_ghrml('ghrml.html', { 'name' : name })

# settings.py ###

import os.path
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates').replace('\
\','/'),
)

# add the ganshi templates path
GENSHI_TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'temp').replace('\\','/'),
)

This is basically all the necessary configuration (other than
installing ghrml),
and I was able to use both template languages in my views.

Haml has gathered quite a crowd in the RoR community, and from
personal
experience it's well worth the hype. If I figure out more stuff with
GHRML,
I'll post to this thread.

Thanks!

> You need to be aware, though, that if you choose a different template
> language, this will mean that you will have to call a different
> render_to_response/render_to_string. Which means, in particular, that if you
> want to use a third-party application which has its own views, you'll probably
> end up having to rewrite the views so that it can find your layout, for
> instance. Same for apps with their own tag library (like django-compress).
>
> Cheers,
>
> Emm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



GHRML Documentation

2009-06-13 Thread gte351s

I'm trying to learn how to work with django after working with ruby on
rails for some time (not too long). Rails has a nice template language
called Haml (http://haml.hamptoncatlin.com/), which I find much more
readable than regular HTML. It is also indent oriented, which all
python fans must find appealing (myself included).

I found a similar template language called GHRML (http://
www.ghrml.org) for django, but the documentation on it is very scarce.
It's also very young (currently in v0.11), and I'm not sure if it's
even being actively developed anymore. I'm trying to find out if it
supports basic template stuff like "extends" and conditionals, so if
anyone who's using it could point me to some good docs on it, assuming
those exist, that'll be great. Thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---