Re: https / nginx / uwsgi / django problems with authentification

2011-07-20 Thread Roberto De Ioris

> Hi,
>
> I'm not sure whether I have to change my django configuration or my
> nginx cofiguration.
> (Thus posted to gmane.comp.python.django.user and to
> gmane.comp.web.nginx.english)
>
> I have following setup:
>
> - nginx listening on https
> - most static contents like .css .js images served by nginx
> - everything else forwarded to django
>
> all .html files are in fact templated and should thus be treated by
> django. Additionally I wanted to grant access to the contents onlyy to
> authorized users.
>
>
> djangu urls.py setup
> ---
>
> from django.contrib.auth.decorators import login_required
> from django.views.generic.simple import direct_to_template
>
>
>  url(r'^(?P.*\.html)$',
>   login_required(direct_to_template),
>  ),
>
>
> nginx is configured with
> -
>
> location ~ \.*.html$ {
> uwsgi_pass django;
> uwsgi_param  QUERY_STRING   $query_string;
> uwsgi_param  REQUEST_METHOD $request_method;
> uwsgi_param  CONTENT_TYPE   $content_type;
> uwsgi_param  CONTENT_LENGTH $content_length;
>
> uwsgi_param  REQUEST_URI$request_uri;
> uwsgi_param  PATH_INFO  $document_uri;
> uwsgi_param  DOCUMENT_ROOT  $document_root;
> uwsgi_param  SERVER_PROTOCOL$server_protocol;
>
> uwsgi_param  REMOTE_ADDR$remote_addr;
> uwsgi_param  REMOTE_PORT$remote_port;
> uwsgi_param  SERVER_PORT$server_port;
> uwsgi_param  SERVER_NAME$server_name;
> }
>
> uwsgi is called with
> --
> uwsgi -s host:port  -H virtual_env_python --pidfile uwsgi.pid \
> --pp ..-w wsgi_module
>
> The problem is, that the first request to
>
> https://mysite:myport/index.html
>
> is detected as non authenticated access. (that's what I want)
> and thus django tries to redirect to  redirected to the authentification
> page (that's also what I want)
> which should be
>
> Django should redirect to
> https://mysite:myport/accounts/login/?next=/index.html
>
> Unfortunately it redirects to
> http://mysite:myport/accounts/login/?next=/index.html
>
>
> Therefore I get the error message
> "400 Bad Request The plain HTTP request was sent to HTTPS port"
>
> Is there any variable that I can use to tell django, that the protocol
> is https and not http for the login pages
>
> Ideally I would like to have something like an nginx parameter being
> passed, such that django knows whether the request is coming from an
> nginx https server ( all redirects should be https:host:port )
> or from an nginx http server.
>
>
> Does anyone have a similiar setup or has some ideas?
>



You can force the protocol using the HTTPS variable (standard, but not
enabled in nginx) or you can force the protocol to htts using the
UWSGI_SCHEME variable

http://projects.unbit.it/uwsgi/wiki/uWSGIVars



-- 
Roberto De Ioris
http://unbit.it

-- 
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.



Is there a way to insert data from a csv file into my database?

2011-07-20 Thread Eiram
Greetings,

I'm a newbie in databases, and I was wondering if there is possible to
insert data from a csv file into one of the tables of my database. I
heard that you can use a tool called pgloader, but I don't know how to
use this tool or if it is possible to do this with django. Does anyone
knows a way to do this on django or pgloader? I really will appreciate
your help.

Best Regards,

Jary

-- 
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: problem with BooleanField form

2011-07-20 Thread ed
I'm using the following javascript, so I can't check the HTML, can I?
How would I go about debugging this?

function bookmark_save() {
var item = $(this).parent();
var data = {
url: item.find("#id_url").val(),
title: item.find("#id_title").val(),
tags: item.find("#id_tags").val()
};
$.post("/save/?ajax", data, function (result) {
if (result != "failure") {
item.before($("li", result).get(0));
item.remove();
$("ul.bookmarks .edit").click(bookmark_edit);
}
else {
alert("Failed to validate bookmark before saving.");
}
});
return false;
}

function bookmark_edit() {
var item = $(this).parent();
var url = item.find(".title").attr("href");
item.load(
"/save/?ajax=" + encodeURIComponent(url),
null,
function () {
$("#save-form").submit(bookmark_save);
}
);
return false;
}

$(document).ready(function () {
$("ul.bookmarks .edit").click(bookmark_edit);
});

On Jul 20, 4:12 pm, SmileyChris  wrote:
> It should definitely be {'share': True} if you've checked the box and
> submitted the form.
>
> Have you ensured your checkbox inside the form tag you're submitting in
> HTML?

-- 
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.



https / nginx / uwsgi / django problems with authentification

2011-07-20 Thread Gelonida N
Hi,

I'm not sure whether I have to change my django configuration or my
nginx cofiguration.
(Thus posted to gmane.comp.python.django.user and to
gmane.comp.web.nginx.english)

I have following setup:

- nginx listening on https
- most static contents like .css .js images served by nginx
- everything else forwarded to django

all .html files are in fact templated and should thus be treated by
django. Additionally I wanted to grant access to the contents onlyy to
authorized users.


djangu urls.py setup
---

from django.contrib.auth.decorators import login_required
from django.views.generic.simple import direct_to_template


 url(r'^(?P.*\.html)$',
login_required(direct_to_template),
 ),


nginx is configured with
-

location ~ \.*.html$ {
uwsgi_pass django;
uwsgi_param  QUERY_STRING   $query_string;
uwsgi_param  REQUEST_METHOD $request_method;
uwsgi_param  CONTENT_TYPE   $content_type;
uwsgi_param  CONTENT_LENGTH $content_length;

uwsgi_param  REQUEST_URI$request_uri;
uwsgi_param  PATH_INFO  $document_uri;
uwsgi_param  DOCUMENT_ROOT  $document_root;
uwsgi_param  SERVER_PROTOCOL$server_protocol;

uwsgi_param  REMOTE_ADDR$remote_addr;
uwsgi_param  REMOTE_PORT$remote_port;
uwsgi_param  SERVER_PORT$server_port;
uwsgi_param  SERVER_NAME$server_name;
}

uwsgi is called with
--
uwsgi -s host:port  -H virtual_env_python --pidfile uwsgi.pid \
--pp ..-w wsgi_module

The problem is, that the first request to

https://mysite:myport/index.html

is detected as non authenticated access. (that's what I want)
and thus django tries to redirect to  redirected to the authentification
page (that's also what I want)
which should be

Django should redirect to
https://mysite:myport/accounts/login/?next=/index.html

Unfortunately it redirects to
http://mysite:myport/accounts/login/?next=/index.html


Therefore I get the error message
"400 Bad Request The plain HTTP request was sent to HTTPS port"

Is there any variable that I can use to tell django, that the protocol
is https and not http for the login pages

Ideally I would like to have something like an nginx parameter being
passed, such that django knows whether the request is coming from an
nginx https server ( all redirects should be https:host:port )
or from an nginx http server.


Does anyone have a similiar setup or has some ideas?


-- 
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: Receiving [Django] ERROR via email even if DEBUG = True

2011-07-20 Thread SmileyChris
It certainly sounds like DEBUG isn't actually True.

To test, from a manage.py shell:
from django.conf import settings
assert settings.DEBUG

No error there?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/viU9aA1_eHgJ.
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: How to disable specific field validaton in form?

2011-07-20 Thread SmileyChris
Would it be acceptable to just not bind the form at all in the situation 
where you want to return the more complex form? Something like:

YourForm(initial=dict(request.POST.items()))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Z9FzXfAkSfcJ.
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: problem with BooleanField form

2011-07-20 Thread SmileyChris
It should definitely be {'share': True} if you've checked the box and 
submitted the form.

Have you ensured your checkbox inside the form tag you're submitting in 
HTML?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SvpPbOOrypAJ.
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.



problem with BooleanField form

2011-07-20 Thread ed
I'm learning Django by following the turorials in Django 1.0 Website
Development by Ayman Hourieh. I've been banging my head for a while on
this and I know it's probably something really simple that I'm
missing.

I'm using the following form:

class BookmarkSaveForm(forms.Form):

share = forms.BooleanField(
label=u'Share on the main page',
required=False
)


So when the form displays fine, but when I check the checkbox and
submit the form I get the following for form.cleaned_data:

{'share': False}

Shouldn't I be seeing "'share': True", not "'share': False"? Or am I
understanding this incorrectly?

-- 
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: 'settings' referenced before assignment

2011-07-20 Thread ydjango
Thank you. That was exactly the issue. I renamed the local variable.


On Jul 20, 2:04 pm, Ian Clelland  wrote:
> On Wed, Jul 20, 2011 at 1:14 PM, ydjango  wrote:
> > Occasionally I see this error in my app,
>
> > UnboundLocalError: local variable 'settings' referenced before
> > assignment
>
> > I have in my views .py
>
> > from django.conf import settings
> > other imports...
>
> > def new_view(request):
> >        if not request.user.is_authenticated():
> >            return HttpResponseRedirect(settings.ENV_URL) <-=== this
> > is where error is thrown.
> >        ...
>
> > What could be the reason? How can I prevent from occurring.
>
> > I am using django 1.1, python 2.5 and mod_wsgi
>
> If, later in your view function, you have an assignment to settings,
> something like
>
> settings = "abcde"
>
> then, when the Python parser first examines your function, it will classify
> settings as a local variable, regardless of whether it is imported above or
> not. Accessing that local variable before its first assignment will be
> considered an error, and Python will refuse to compile the function.
>
> To fix this, you should either put "global settings" at the top of your
> function (if you really do want to overwrite it), or remove the assignment
> to the 'settings' variable (if you don't), or change the name of the
> variable you assign to (if it was an accident).
>
> --
> Regards,
> Ian Clelland
> 

-- 
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: 'settings' referenced before assignment

2011-07-20 Thread Ian Clelland
On Wed, Jul 20, 2011 at 1:14 PM, ydjango  wrote:

> Occasionally I see this error in my app,
>
> UnboundLocalError: local variable 'settings' referenced before
> assignment
>
> I have in my views .py
>
> from django.conf import settings
> other imports...
>
> def new_view(request):
>if not request.user.is_authenticated():
>return HttpResponseRedirect(settings.ENV_URL) <-=== this
> is where error is thrown.
>...
>
> What could be the reason? How can I prevent from occurring.
>
> I am using django 1.1, python 2.5 and mod_wsgi
>
>
If, later in your view function, you have an assignment to settings,
something like

settings = "abcde"

then, when the Python parser first examines your function, it will classify
settings as a local variable, regardless of whether it is imported above or
not. Accessing that local variable before its first assignment will be
considered an error, and Python will refuse to compile the function.

To fix this, you should either put "global settings" at the top of your
function (if you really do want to overwrite it), or remove the assignment
to the 'settings' variable (if you don't), or change the name of the
variable you assign to (if it was an accident).


-- 
Regards,
Ian Clelland


-- 
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.



Pycrypto----> DLL load failed: The specified module could not be found.

2011-07-20 Thread Lycan
Hello

In my views.py i have this line of code "from Crypto.Hash import
SHA256", it works fine on localhost.But when i try to launch my live
website(using Apache 2.2 and mod_wsgi), I am seeing the following
error:

ImportError at /accounts/profile/apps
DLL load failed: The specified module could not be found.

I cant figure out what the problem is. Please help.

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.



'settings' referenced before assignment

2011-07-20 Thread ydjango
Occasionally I see this error in my app,

UnboundLocalError: local variable 'settings' referenced before
assignment

I have in my views .py

from django.conf import settings
other imports...

def new_view(request):
if not request.user.is_authenticated():
return HttpResponseRedirect(settings.ENV_URL) <-=== this
is where error is thrown.
...

What could be the reason? How can I prevent from occurring.

I am using django 1.1, python 2.5 and mod_wsgi

-- 
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: Improperly Configured Remote User Middleware

2011-07-20 Thread John
I changed my uat instance to point at PostgreSQL instead of SQLite and
now it works. I touched nothing relating to this issue, but it looks
like it worked itself out. I would imagine there was some caching of
something somewhere that was not getting overwritten.

Thanks anyway.

On Jul 20, 12:35 pm, John  wrote:
> I am trying to get sso working with apache and Django. I have the
> REMOTE_USER being filled correctly with
> mod_auth_kerb, and I followed the simple directions listed 
> athttps://docs.djangoproject.com/en/dev/howto/auth-remote-user/
> in an attempt to enable Django's REMOTE_USER authentication.
>
> I am able to successfully start and run my development server with
> manage.py runserver. The authentication fails
> because there is no REMOTE_USER, but I am able to browse around the
> public stuff like normal.
>
> When I try to access it through apache, I get:
>         The Django remote user auth middleware requires the
> authentication middleware to be installed.
>         Edit your MIDDLEWARE_CLASSES setting to insert
> 'django.contrib.auth.middleware.AuthenticationMiddleware'
>         before the RemoteUserMiddleware class.
>
> I then scroll down through the Request Information and see:
>
> MIDDLEWARE_CLASSES
> ('django.contrib.sessions.middleware.SessionMiddleware',
>
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>
> 'django.contrib.auth.middleware.RemoteUserMiddleware',
>
> 'django.middleware.common.CommonMiddleware',
>
> 'django.middleware.csrf.CsrfViewMiddleware',
>
> 'django.contrib.messages.middleware.MessageMiddleware')
>
> Which matches my settings.py:
>
> MIDDLEWARE_CLASSES =  (
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.auth.middleware.RemoteUserMiddleware',
>     'django.middleware.common.CommonMiddleware',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.contrib.messages.middleware.MessageMiddleware',
> )
>
> I don't get it, am I missing something obvious here? I have tried
> reordering everything, deleting and re-adding the files,
> and googling for a couple of hours. Hopefully someone here will be
> able to point me in the right direction because I am
> out of ideas.
>
> Thanks in advance for any help.

-- 
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: get django/lighttpd "hello world" page

2011-07-20 Thread Phil
thanks Javier.

On Jul 20, 8:13 pm, Javier Guerra Giraldez  wrote:
> On Wed, Jul 20, 2011 at 2:02 PM, Phil  wrote:
> >            "host" => "my ip address",
>
> sometimes flup (and other fastcgi launchers) bind only to the
> 127.0.0.1 IP.  if you want to put the webserver and webapp on
> different machines, be sure to bind to all IPs (typically setting "0"
> as IP on the launcher).  if both webserver and webapp are on the same
> machine, faster and safer is to use 127.0.0.1 (and even faster and
> safer is to use socket files)
>
> --
> Javier

-- 
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: get django/lighttpd "hello world" page

2011-07-20 Thread Javier Guerra Giraldez
On Wed, Jul 20, 2011 at 2:02 PM, Phil  wrote:
>            "host" => "my ip address",

sometimes flup (and other fastcgi launchers) bind only to the
127.0.0.1 IP.  if you want to put the webserver and webapp on
different machines, be sure to bind to all IPs (typically setting "0"
as IP on the launcher).  if both webserver and webapp are on the same
machine, faster and safer is to use 127.0.0.1 (and even faster and
safer is to use socket files)

-- 
Javier

-- 
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: get django/lighttpd "hello world" page

2011-07-20 Thread Phil
thanks Javier! I switched it to port 8080 now.

I have a "lighttpd/lighttpd.conf" with the following...

server.document-root = "/var/www"

$HTTP["host"] =~ "(^|\.)mydomain\.com$" {
fastcgi.server = (
"/var/www/mydomain.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "my ip address",
"port" => 8080,
#"socket" => "/home/user/mysite.sock",
#"check-local" => "disable",
)
),
)
}


But I also have a "lighttpd/conf-enabled/10-fastcgi.conf" file with
the following

server.modules += ( "mod_fastcgi" )

$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( ".py" => "/usr/bin/python" )
}

## Warning this represents a security risk, as it allow to execute any
file
## with a .pl/.php/.py even outside of /usr/lib/cgi-bin.
#
cgi.assign  = (
#   ".pl"  => "/usr/bin/perl",
#   ".php" => "/usr/bin/php-cgi",
   ".py"  => "/usr/bin/python",
)


Do I have the correct code in the right place or am I missing
something out?


On Jul 20, 7:52 pm, Javier Guerra Giraldez  wrote:
> On Wed, Jul 20, 2011 at 1:42 PM, Phil  wrote:
> > if I can get a standard HTML to display on port 80 with lighttpd does
> > that still mean I have to use a different port for fcgi?
>
> absolutely.
>
> the port used between the webserver and webapp must _not_ be the same
> where the browsers connect to the webserver.
>
> --
> Javier

-- 
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: get django/lighttpd "hello world" page

2011-07-20 Thread Javier Guerra Giraldez
On Wed, Jul 20, 2011 at 1:42 PM, Phil  wrote:
> if I can get a standard HTML to display on port 80 with lighttpd does
> that still mean I have to use a different port for fcgi?

absolutely.

the port used between the webserver and webapp must _not_ be the same
where the browsers connect to the webserver.

-- 
Javier

-- 
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: get django/lighttpd "hello world" page

2011-07-20 Thread Phil
if I can get a standard HTML to display on port 80 with lighttpd does
that still mean I have to use a different port for fcgi?

On Jul 18, 10:59 pm, Javier Guerra Giraldez 
wrote:
> On Mon, Jul 18, 2011 at 4:55 PM, Phil  wrote:
> > I did run "./manage.py runfcgi
> > method=threaded host=my ip address port=80"
>
> don't use port 80 for FastCGI.  chances are that it's already used
>
> --
> Javier

-- 
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.



Improperly Configured Remote User Middleware

2011-07-20 Thread John
I am trying to get sso working with apache and Django. I have the
REMOTE_USER being filled correctly with
mod_auth_kerb, and I followed the simple directions listed at
https://docs.djangoproject.com/en/dev/howto/auth-remote-user/
in an attempt to enable Django's REMOTE_USER authentication.

I am able to successfully start and run my development server with
manage.py runserver. The authentication fails
because there is no REMOTE_USER, but I am able to browse around the
public stuff like normal.

When I try to access it through apache, I get:
The Django remote user auth middleware requires the
authentication middleware to be installed.
Edit your MIDDLEWARE_CLASSES setting to insert
'django.contrib.auth.middleware.AuthenticationMiddleware'
before the RemoteUserMiddleware class.

I then scroll down through the Request Information and see:

MIDDLEWARE_CLASSES
('django.contrib.sessions.middleware.SessionMiddleware',
 
'django.contrib.auth.middleware.AuthenticationMiddleware',
 
'django.contrib.auth.middleware.RemoteUserMiddleware',
 
'django.middleware.common.CommonMiddleware',
 
'django.middleware.csrf.CsrfViewMiddleware',
 
'django.contrib.messages.middleware.MessageMiddleware')

Which matches my settings.py:

MIDDLEWARE_CLASSES =  (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

I don't get it, am I missing something obvious here? I have tried
reordering everything, deleting and re-adding the files,
and googling for a couple of hours. Hopefully someone here will be
able to point me in the right direction because I am
out of ideas.

Thanks in advance for any help.

-- 
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.



Running Django on a Shared-Hosting Provider with Apache

2011-07-20 Thread Rick Beacham
Running Django on a Shared-Hosting Provider with Apache

When i go to run the mysite.fcgi it prints out itself in the
browser..Is there something wrong here?  I have followed the steps
to the tee..

http://localhost/mysite.fcgi
print out this:
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/usr/bin/python2.7")

# Switch to the directory of your project. (Optional.)
# os.chdir("/home/user/myproject")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="true")

here is my .htaccess file

Handler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]

is it a permission problem?



-- 
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: Odp: Re: Django admin - utf8 filename

2011-07-20 Thread urukay
Why not to change filename during the upload?

Radovan
http://www.yau.sk

On 19. Júl, 17:24 h., galgal  wrote:
> OK I managed to do that - I can upload utf8 files now.
> But after uploading it i can't see file form field to change file:/

-- 
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: How to best use gunicorn with multiple virtualenv's

2011-07-20 Thread Shawn Milochik
I just create a different user account for each application I'm
running. So each user account has its own virtualenv, gunicorn, etc.
Obviously just one nginx instance.

-- 
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.



How to disable specific field validaton in form?

2011-07-20 Thread galgal
I need to disable field validation in ModelForm. I want this validation not 
to validate some field. I have some situations (AJAX rendering form) when I 
want to return more complex form with additional fields. I pass POST to the 
form and render new one with post fields saved. Some new fields are added 
and they can't be validated. I pass flag to form and recognize when it 
happens. Should I make it in some clean functions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/YYieKI6WHk8J.
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: Pasta root

2011-07-20 Thread Tom Evans
On Wed, Jul 20, 2011 at 1:47 PM, Andre Terra  wrote:
> Oh, I didn't know that. Has that always been the case or was that feature
> added in a recent version?
>
> Anyway, thanks, Tom!
>
>
> Cheers,
> AT
>

4 years ago :)

https://code.djangoproject.com/changeset/5379


Cheers

Tom

-- 
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: creating dynamic forms with django

2011-07-20 Thread ken paul
Hey you know the link actually has what I want thanks
Kenneth


On Wed, Jul 20, 2011 at 3:27 PM, ken paul  wrote:

> Thank man but what I mean is like you create a dynamic class
> ||new_class=type('myform',(forms.Form),{attrib})|| but the dict with attribs
> is a bit complex coz the form attributes have there own attributes and
> widgets
> Kenneth
>
>
>
> On Wed, Jul 20, 2011 at 1:00 PM, NISA BALAKRISHNAN <
> snisa.balakrish...@gmail.com> wrote:
>
>> may be dis link helps u:
>>
>> http://uswaretech.com/blog/2008/10/dynamic-forms-with-django/
>>
>> On Wed, Jul 20, 2011 at 12:46 PM, ken paul  wrote:
>>
>>> hey can anyone get a way of writing dynamic form classes with django. I
>>> have tried but putting the attributes became a bit hard.
>>> Kenneth
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Thanks & Regards,
>>
>> Nisa Balakrishnan,
>> SHARJAH, UAE.
>>
>> --
>> 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.
>>
>
>

-- 
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: Pasta root

2011-07-20 Thread Andre Terra
Oh, I didn't know that. Has that always been the case or was that feature
added in a recent version?

Anyway, thanks, Tom!


Cheers,
AT

On Wed, Jul 20, 2011 at 9:44 AM, Tom Evans  wrote:

> On Wed, Jul 20, 2011 at 1:01 PM, Andre Terra  wrote:
> > From what I'm seeing, you haven't created your own context processor,
> > and the default processors do not add MEDIA_URL to the context.
> >
>
> django.core.context_processors.media adds MEDIA_URL to the context,
> and is in TEMPLATE_CONTEXT_PROCESSORS in global_settings.
>
> OP has overridden his TEMPLATE_CONTEXT_PROCESSORS, and not included
> django.core.context_processors.media, which is why it is unavailable.
> He doesn't need to write his own context processor, he needs to
> include the ones that are included by default.
>
> Cheers
>
> Tom
>
> --
> 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.
>
>

-- 
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: Pasta root

2011-07-20 Thread Tom Evans
On Wed, Jul 20, 2011 at 1:01 PM, Andre Terra  wrote:
> From what I'm seeing, you haven't created your own context processor,
> and the default processors do not add MEDIA_URL to the context.
>

django.core.context_processors.media adds MEDIA_URL to the context,
and is in TEMPLATE_CONTEXT_PROCESSORS in global_settings.

OP has overridden his TEMPLATE_CONTEXT_PROCESSORS, and not included
django.core.context_processors.media, which is why it is unavailable.
He doesn't need to write his own context processor, he needs to
include the ones that are included by default.

Cheers

Tom

-- 
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: creating dynamic forms with django

2011-07-20 Thread ken paul
Thank man but what I mean is like you create a dynamic class
||new_class=type('myform',(forms.Form),{attrib})|| but the dict with attribs
is a bit complex coz the form attributes have there own attributes and
widgets
Kenneth


On Wed, Jul 20, 2011 at 1:00 PM, NISA BALAKRISHNAN <
snisa.balakrish...@gmail.com> wrote:

> may be dis link helps u:
>
> http://uswaretech.com/blog/2008/10/dynamic-forms-with-django/
>
> On Wed, Jul 20, 2011 at 12:46 PM, ken paul  wrote:
>
>> hey can anyone get a way of writing dynamic form classes with django. I
>> have tried but putting the attributes became a bit hard.
>> Kenneth
>>
>> --
>> 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.
>>
>
>
>
> --
> Thanks & Regards,
>
> Nisa Balakrishnan,
> SHARJAH, UAE.
>
> --
> 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.
>

-- 
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.



Komodo IDE better screenshots (worth reading!)

2011-07-20 Thread Cal Leeming [Simplicity Media Ltd]
For me, looks are extremely important when it comes to an IDE, especially
when I spend 12+ hours a day doing nothing but Django/Python development.

When looking at Komodo, I *almost* rejected it on the basis that all the
available screenshots looks hideous.

OSX:
http://www.i-cherubini.it/mauro/blog/uploads/images/ss_Komodo_rails_large.gif
Linux: http://www.qweas.com/downloads/development/other/scr-komodo-ide.png
Windows:
http://www.activestate.com/sites/default/files/images/komodo/platforms_win_720_label.png

So, after some config modifications, and a few plugins, here is a screenshot
of how clean/pretty it is now:

http://i.imgur.com/OsKuL.png
http://i.imgur.com/UuXmO.png

For this I'm using:

font: Consolas 8px
addons: aero theme, FamFamFam Silk Icons, NST, Tweak UI
tweak ui: Used to move tabs around the screen
config: horizontal tabs instead of vertical.
screen size: 1920x1080

The toolbox is also a lovely little feature (lets you add all sorts of
custom macros and auto runs)

Downside, the 'formatting/reindentation' selection tool is absolutely
terrible (it just doesn't work lol).

Hope this helps someone else.

Cal

-- 
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.



Receiving [Django] ERROR via email even if DEBUG = True

2011-07-20 Thread Federico Capoano
Hi,

i'm using django 1.4 alpha from SVN. I get email notification for
errors on my local machine which I use to develop.

How can I turn these notifications off?

DEBUG is True on my settings.py.

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: DeprecationWarning displayed in test, not in dev

2011-07-20 Thread Andre Terra
Great! Thank you Tom and Russ for the heads up.


Cheers,
AT

On 7/20/11, Tom Evans  wrote:
> On Wed, Jul 20, 2011 at 3:24 AM, Russell Keith-Magee
>  wrote:
>> The problem here actually lies with Python.
>>
>> For some reason, Python 2.7 changed the reporting behavior of Warnings
>> so that DeprecationWarning is ignored by default [1]. So, because
>> you're developing in Python 2.7, you don't see the warnings by
>> default; in production, where you're using Python 2.5, you do.
>>
>> [1] http://docs.python.org/library/warnings.html#warning-categories
>>
>> Yours,
>> Russ Magee %-)
>
> Thanks Russ, that explains it perfectly. For the archives, you can
> override this on the command line, eg:
>
> python -W once manage.py etc
>
> Which gives me a lot of lovely warnings to work through :)
>
> Cheers
>
> Tom
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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: Pasta root

2011-07-20 Thread Andre Terra
>From what I'm seeing, you haven't created your own context processor,
and the default processors do not add MEDIA_URL to the context.

In other words, MEDIA_URL will always be null unless you explicitly
pass it to the template. You could do this on every view, or write a
context processor that automatically sends it every time.

Please refer to the official docs to learn how to define a custom
context processor, or read my explanation on SO:

http://stackoverflow.com/questions/3722174/django-template-inheritance-and-context/3731459#3731459


Cheers,
AT

On 7/20/11, Jussiê Vieira Toledo  wrote:
> ok, sorry
>
> I did not see that it was only in English.
>
> At first everything is configured ok, and processors of the templates here's
> the code:
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>  "django.core.context_processors.auth"
>  "django.core.context_processors.request"
>  # "grappelli.context_processors.admin_url"
> )
>
> Thank you.
>
>
>
> --
>
> *
>  Jussiê Vieira Toledo
> *
> Web Developer
>
> *
> *
>
> *
>
> *Conheça a OdiG.net 
> Siga a @MundoOdiG 
> Curta a OdiG no
> Facebook
> Conecte-se no
> LinkedIn
> Ligue para (55) 3028-2068
> *
> *
> *Sobre **
> Jussiê Vieira Toledo
> *
> no Twitter: @jussievt 
>
>
> 2011/7/19 Andre Terra 
>
>> Are you using a context processor to pass MEDIA_URL to the template?
>>
>> How are you serving your static files? Have you setup your server
>> correctly, or configured django to serve them?
>>
>> Finally, please post in English so that everyone can understand your
>> question, not only for the sake of helping, but also so that others
>> might learn from the answers as well.
>>
>>
>> Best regards,
>> Andre Terra
>>
>> On 7/19/11, Jussiê Vieira Toledo  wrote:
>> > E ae galera!
>> >
>> > Estou tentando carregar um css para uma página, mas no caminho não
>> > estou acertando.
>> > Como vejo qual é a minha pasta root?
>> >
>> > Por exemplo estou tentando desta duas formas:
>> > 1 - > > type="text/css" />
>> > onde MEDIA_URL = '/media/' e
>> > MEDIA_ROOT = os.path.join(PROJECT_ROOT_PATH, 'media')
>> >
>> > e 2 -
>> > > > type="text/css" />
>> > onde a pasta "cida" seria onde eu dei o startproject
>> >
>> > Valeu ae galera,
>> >
>> > --
>> > 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.
>> >
>> >
>>
>> --
>> Sent from my mobile device
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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: DeprecationWarning displayed in test, not in dev

2011-07-20 Thread Tom Evans
On Wed, Jul 20, 2011 at 3:24 AM, Russell Keith-Magee
 wrote:
> The problem here actually lies with Python.
>
> For some reason, Python 2.7 changed the reporting behavior of Warnings
> so that DeprecationWarning is ignored by default [1]. So, because
> you're developing in Python 2.7, you don't see the warnings by
> default; in production, where you're using Python 2.5, you do.
>
> [1] http://docs.python.org/library/warnings.html#warning-categories
>
> Yours,
> Russ Magee %-)

Thanks Russ, that explains it perfectly. For the archives, you can
override this on the command line, eg:

python -W once manage.py etc

Which gives me a lot of lovely warnings to work through :)

Cheers

Tom

-- 
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: creating dynamic forms with django

2011-07-20 Thread NISA BALAKRISHNAN
may be dis link helps u:

http://uswaretech.com/blog/2008/10/dynamic-forms-with-django/

On Wed, Jul 20, 2011 at 12:46 PM, ken paul  wrote:

> hey can anyone get a way of writing dynamic form classes with django. I
> have tried but putting the attributes became a bit hard.
> Kenneth
>
> --
> 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.
>



-- 
Thanks & Regards,

Nisa Balakrishnan,
SHARJAH, UAE.

-- 
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: Pasta root

2011-07-20 Thread Jussiê Vieira Toledo
ok, sorry

I did not see that it was only in English.

At first everything is configured ok, and processors of the templates here's
the code:

TEMPLATE_CONTEXT_PROCESSORS = (
 "django.core.context_processors.auth"
 "django.core.context_processors.request"
 # "grappelli.context_processors.admin_url"
)

Thank you.



--

*
 Jussiê Vieira Toledo
*
Web Developer

*
*

*

*Conheça a OdiG.net 
Siga a @MundoOdiG 
Curta a OdiG no
Facebook
Conecte-se no 
LinkedIn
Ligue para (55) 3028-2068
*
*
*Sobre **
Jussiê Vieira Toledo
*
no Twitter: @jussievt 


2011/7/19 Andre Terra 

> Are you using a context processor to pass MEDIA_URL to the template?
>
> How are you serving your static files? Have you setup your server
> correctly, or configured django to serve them?
>
> Finally, please post in English so that everyone can understand your
> question, not only for the sake of helping, but also so that others
> might learn from the answers as well.
>
>
> Best regards,
> Andre Terra
>
> On 7/19/11, Jussiê Vieira Toledo  wrote:
> > E ae galera!
> >
> > Estou tentando carregar um css para uma página, mas no caminho não
> > estou acertando.
> > Como vejo qual é a minha pasta root?
> >
> > Por exemplo estou tentando desta duas formas:
> > 1 -  > type="text/css" />
> > onde MEDIA_URL = '/media/' e
> > MEDIA_ROOT = os.path.join(PROJECT_ROOT_PATH, 'media')
> >
> > e 2 -
> >  > type="text/css" />
> > onde a pasta "cida" seria onde eu dei o startproject
> >
> > Valeu ae galera,
> >
> > --
> > 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.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> 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.
>
>

-- 
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.



creating dynamic forms with django

2011-07-20 Thread ken paul
hey can anyone get a way of writing dynamic form classes with django. I have
tried but putting the attributes became a bit hard.
Kenneth

-- 
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: NameError at /admin/

2011-07-20 Thread lokesh
Hi,

In admin.py yourprojectname is missing. Instead of from
news.models import Articles, try from yourprojectname.news.models
import Articles.
Lokesh S

On Jul 18, 7:06 pm, arthur_mwai  wrote:
> I wanted to register an app called "news" in the admin site and i got
> this error:
>
> NameError at /admin/
> name 'news' is not defined
> Request Method: GET
> Request URL:    http://127.0.0.1:8000/admin/
> Django Version: 1.3
> Exception Type: NameError
> Exception Value:
> name 'news' is not defined
> Exception Location:     /home/arthur/code_testing/news/admin.py in
> , line 3
>
> here is my admi.py:
>
> from django.contrib import admin
> from news.models import Articles
>
> class ArticlesAdmin(admin.ModelAdmin):
>   pass
> admin.site.register(Articles,ArticlesAdmin)
>
> and below is my urls.py
> from django.conf.urls.defaults import patterns, include, url
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     # Examples:
>     # url(r'^$', 'code_testing.views.home', name='home'),
>     # url(r'^code_testing/', include('code_testing.foo.urls')),
>
>     # Uncomment the admin/doc line below to enable admin
> documentation:
>     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
>     # Uncomment the next line to enable the admin:
>     url(r'^admin/', include(admin.site.urls)),
> )

-- 
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: How to get parent id in inline html

2011-07-20 Thread Burcu Hamamcıoğlu
I found the solution; change_view  view sends a parameter named "object_id"
to the html. This was enough helpfull for me.

20 Temmuz 2011 00:03 tarihinde Burcu Hamamcıoğlu  yazdı:

> Hi all,  I've customized edit_inline.html for my inline section. I
> need parent model's id/pk in the inline template. How can I get it? Is there
> any way to reach it?

-- 
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.



How to best use gunicorn with multiple virtualenv's

2011-07-20 Thread Benedict Verheyen
Hi,


I just discovered gunicorn after some problems with wsgi.
It seems like a very clean setup together with supervisord.
However, it's not clear to me how you set it up when you
have multiple virtualenvs.

It's easy enough to install gunicorn in a virtualenv and then
specify a upstream  in nginx.conf.
This is the part that bugs me.
Do you specify an upstream server for every virtualenv (and thus
website)?
For instance, something like this:

nginx.conf
...
http {
upstream app_server_1 {
server 127.0.0.1:8000 fail_timeout=0;
}
upstream app_server_2 {
server 127.0.0.1:8001 fail_timeout=0;
}
server {
listen   80;
server_name  app_1;
location / {
...
proxy_pass http://app_server_1;
...
}
}
server {
listen   80;
server_name  app_2;
location / {
...
proxy_pass http://app_server_2;
...
}
}
}

The apps are then started with gunicorn_django and following configs:

gunicorn.conf.py for app_1
bind = "127.0.0.1:8000"
workers = 3
...

gunicorn.conf.py for app_2
bind = "127.0.0.1:8001"
workers = 3
...

Is this is sound setup or to much overhead?
It's seems ok however, I do get a warning from nginx:

Restarting nginx:
[warn]: conflicting server name "app_1" on 0.0.0.0:80, ignored
[warn]: conflicting server name "app_2" on 0.0.0.0:80, ignored


Are there other ways to serve multiple sites from different
virtualenv's?

Cheers,
Benedict

-- 
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.