Re: Calling ffmpeg doesn't work on apache server

2013-06-20 Thread Ovnicraft
On Wed, Jun 19, 2013 at 6:01 PM, Chad Vernon  wrote:

> I'm trying to use ffmpeg to generate a thumbnail for a video.  It works
> just fine when I call it from a python shell and when I test it in "python
> manage.py shell".  However when I try to run from the apache server running
> locally, I get an error:
>
> # normally I call subprocess.call, but for debug here I'm calling
> check_call
> response = subprocess.check_call(['ffmpeg', '-i', self.file.path],
> stderr=fh)
>
> # actual path taken out for brevity
> Command '['ffmpeg', '-i', u'...']' returned non-zero exit status -6
>
>
Can you pastebin de output, when use ffmpeg as subprocess (i did it) you
can get in output what happens, check_output can help you if you want
output in response var.

Regards,


> I've verified that the video path is correct.
>
> Any suggestions?
>
> Thanks!
> Chad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Cristian Salamea
@ovnicraft

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Calling ffmpeg doesn't work on apache server

2013-06-20 Thread Chad Vernon
Hi John,

Yes I am restarting apache after all changes I do.  How do I check what 
workers I have running?

Thanks,
Chad

On Wednesday, June 19, 2013 4:57:00 PM UTC-7, John wrote:
>
>  Chad,
>
> Are you restarting apache after each change? It sounds like you have the 
> default 2 workers and you are getting two different 'versions' alternately. 
> Apache needs to be restarted if you change something (or there's some magic 
> touch you can do with wsgi that I forget).
>
> Otherwise it does look like permissions, or running in the wrong 
> directory, or such like.
>
> John
>
> On 20/06/13 00:48, Chad Vernon wrote:
>  
> One last observation: 
>
>  I think it has something to do with the apache user permissions.  I'm 
> running the mod_wsgi daemon process with myself as the user and I need to 
> specify the full path to ffmpeg (/usr/local/bin/ffmpeg).  Even when I do 
> that the function runs every other time.  So I'm totally confused now.  I'm 
> an apache/django beginner so bear with me please!
>
>  
>  
> On Wednesday, June 19, 2013 4:12:02 PM UTC-7, Chad Vernon wrote: 
>>
>> Looks like it has something to do with calling subprocess from the server 
>> because this gives the same error:
>>
>>  response = subprocess.check_output(['which', 'ls'])
>>
>>  Anyone have any suggestions?
>>
>> On Wednesday, June 19, 2013 4:01:30 PM UTC-7, Chad Vernon wrote: 
>>>
>>> I'm trying to use ffmpeg to generate a thumbnail for a video.  It works 
>>> just fine when I call it from a python shell and when I test it in "python 
>>> manage.py shell".  However when I try to run from the apache server running 
>>> locally, I get an error: 
>>>
>>>  # normally I call subprocess.call, but for debug here I'm calling 
>>> check_call
>>>  response = subprocess.check_call(['ffmpeg', '-i', self.file.path], 
>>> stderr=fh)
>>>  
>>>  # actual path taken out for brevity
>>> Command '['ffmpeg', '-i', u'...']' returned non-zero exit status -6
>>>  
>>>  I've verified that the video path is correct.
>>>
>>>  Any suggestions?
>>>
>>>  Thanks!
>>> Chad
>>>  
>>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: __unicode__() addition not working in basic poll application.

2013-06-20 Thread Manjunath Shivanna
Just restart the python interactive Shell... that should solve your problem

Regards,
Manju

On Monday, May 16, 2011 5:32:41 AM UTC-7, maaz muqri wrote:
>
> Hi, 
>  
> class Poll(models.Model): 
> # ... 
> def __unicode__(self): 
> return self.question 
>
> class Choice(models.Model): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




How to divide my apps? Good practices?

2013-06-20 Thread galgal
Hi,
I'm starting my new project. It's sport-connected.
The main part of my app will be league, matches, teams and players. There 
will be many relations.

So, how to make apps and models. I plan to make models:

   - Season
   - League (FK to Season)
   - Team
   - Match (FK to League and 2FK to Teams)
   - Players (FK to Team)
   - and many more to present teams history in each season etc.
   
Is it better, to make it all in 1 app, called for example Game, or divide 
it into smaller apps?
Thanks for help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: 'SafeText' object has no attribute 'status_code'

2013-06-20 Thread der_fenix
Hello I have problem with render_to_string
django it's showme this error message :
'SafeText' object has no attribute 'status_code'




my view :
def html(request):
context = {'inf':  Itype.objects.all()}
return render_to_string('smg/owl.html',context)  


Views must return Response object. You should use render_to_response in 
your case. 


signature.asc
Description: This is a digitally signed message part.


Re: Django ModelForm is_valid & form_valid

2013-06-20 Thread Jacob Valenta
Thank you good sir! You have put an end to my week long head ache!

On Thursday, June 20, 2013 12:27:36 PM UTC-4, Jason Arnst-Goodrich wrote:
>
> This is a common problem to run into.
>
> def form_valid(self, form): 
>
> customer = form.save(commit=False)
>
> customer.store = self.request.user.active_profile.store
>
> customer.save() 
>
> return super(CustomerInformationView, self).save(form)
>
>
> super(CustomerInformationView, self).save(form)doesn't really make sense 
> to do here for 2 reasons:
>
> 1. You just performed the model save manually the line above.
> 2. It's going to call save again except this time the form value for store 
> is in fact Null (because it's blank in the form) and will raise the error.
>
> So instead of calling super() - just return a httpresponse instead because 
> that's really all you want in this case.
> return HttpResponseRedirect(self.get_success_url())
>
> (make sure you ahve the success url defined. Otherwise specify one.)
>
> Also on your form you probably want to define it to exclude store - and if 
> store is actually required you can probably leave off the blank=True.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Multiple Primary Key composed by a Foreign key

2013-06-20 Thread Javier Guerra Giraldez
On Thu, Jun 20, 2013 at 11:52 AM, Saif Jerbi  wrote:
> I would like to implement multicolumns primary keys in django, i need to

are you proposing to implement multicolumn primary keys? or asking how
is it done?  If the latter, i have bad news: they're not supported
(yet) in Django.


> implement a UserPro model that allow that i have a multiple users who have
> the same username but belong to different Entreprise

there are _very_ few cases where it's appropriate to use anything else
than a 'id' field as primary key.  the user model is not one of those
few.

simply add a unique_together=('enterprise','username') restriction.


--
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Multiple Primary Key composed by a Foreign key

2013-06-20 Thread Saif Jerbi
Hi,
I would like to implement multicolumns primary keys in django, i need to 
implement a UserPro model that allow that i have a multiple users who have 
the same username but belong to different Entreprise
this is my code 

#models.py

from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User
class Provider(models.Model):
name = models.CharField(max_length=250)
adress = models.CharField(max_length=250)

def __unicode__(self):
return '%s %s' % (self.name, self.adress)



class Societe(models.Model):

name = models.CharField(max_length=250)
provider = models.ForeignKey(Provider)

def __unicode__(self):
return '%s -- %s' % (self.name, self.provider.name)

class UserPro(models.Model):

user = models.OneToOneField(User,primary_key=True)
adress = models.CharField(max_length=250)
telephone = models.CharField(max_length=250)
societe = models.ForeignKey(Societe,primary_key=True)
def __unicode__(self):
return '%s' % (self.user.first_name)

#admin.py

from django.contrib import admin
from geo.models import *

admin.site.register(UserPro)
admin.site.register(Societe)
admin.site.register(Provider)


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Low Level Cache Issue

2013-06-20 Thread Max Vizard
Hi there,

I'm having some issues with the low level cache functionality in Django 1.4 
and I can't seem to find info relevant to my exact problem.

I'm running a separate Python script to check on the status of a Master and 
Slave MySQL db pair, which then inserts some values into a local Memcache 
instance.
I know for certain that the values are being inserted into the cache, as I 
can access them from another Python interpreter using pylibmc.

However, when I try to access those same keys from a Django view, the 
results are None. I've configured the CACHES setting to point at the same 
local 
Memcache instance and tried with both django.core.cache.MemcachedCache and 
django.core.cache.PyLibMCCache.

Perhaps my understanding is flawed and Django shouldn't be able to access 
cache values inserted by another process? I would think that this is not 
the case because otherwise the use of such a cache would be quite limited.

I haven't checked that Django can write to the cache and read back for 
itself yet, that is a task for tomorrow.

Any thoughts or input is much appreciated.

Thanks,
Max

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cannot import mypackage with code in the __init__.py file

2013-06-20 Thread Bill Freeman
Well, that would explain it.  For directories the execute bit has to do
with directory traversal, rather than the execution of anything.  No
adjustment to your wsgi config can get around that.

I can't advise you about mappings between windows permissions and *nix
permissions, not what sshclient does about it, since I don't use them.  If
it's not just a matter of having the correct CACLs on the Windows side, or
configuration options to sshclient (or some explicit step you took), you
can always write a script that fixes up ownerships and permissions (will
have to be run with sudo or as root).


On Thu, Jun 20, 2013 at 2:07 PM, fred  wrote:

> OK, I found a fix but not the cause.
> The entire project is copied from W7 using sshclient.  The directories I'm
> having trouble with are not executable, when I changed that it all works.
> Now I wonder if there is something in my wsgi.conf that could be changed to
> all access to them since I don't have this problem with other django 1.3
> wsgi projects.  I posted my wsgi.conf earlier and would appreciate any
> suggestions.
>
> Fred.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




'SafeText' object has no attribute 'status_code'

2013-06-20 Thread cha
Hello I have problem with render_to_string
django it's showme this error message :
'SafeText' object has no attribute 'status_code'

my view :
def html(request):
context = {'inf':  Itype.objects.all()}
return render_to_string('smg/owl.html',context)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cannot import mypackage with code in the __init__.py file

2013-06-20 Thread fred
OK, I found a fix but not the cause.
The entire project is copied from W7 using sshclient.  The directories I'm 
having trouble with are not executable, when I changed that it all works.  
Now I wonder if there is something in my wsgi.conf that could be changed to 
all access to them since I don't have this problem with other django 1.3 
wsgi projects.  I posted my wsgi.conf earlier and would appreciate any 
suggestions.

Fred.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django ModelForm is_valid & form_valid

2013-06-20 Thread Jason Arnst-Goodrich
This is a common problem to run into.

def form_valid(self, form): 

customer = form.save(commit=False)

customer.store = self.request.user.active_profile.store

customer.save() 

return super(CustomerInformationView, self).save(form)


super(CustomerInformationView, self).save(form)doesn't really make sense to 
do here for 2 reasons:

1. You just performed the model save manually the line above.
2. It's going to call save again except this time the form value for store 
is in fact Null (because it's blank in the form) and will raise the error.

So instead of calling super() - just return a httpresponse instead because 
that's really all you want in this case.
return HttpResponseRedirect(self.get_success_url())

(make sure you ahve the success url defined. Otherwise specify one.)

Also on your form you probably want to define it to exclude store - and if 
store is actually required you can probably leave off the blank=True.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django polls application problem

2013-06-20 Thread Satinderpal Singh
On Thu, Jun 20, 2013 at 7:56 PM, Kamal Kaur  wrote:
> I am new to Django. Creating my first application, Polls. Some field was
> missing in database when I tried to enter multiple
> choices in a poll from terminal. Even it was not done when admin.py
> file was changed to show a bunch of choices. Now previous database is
> dropped and a new one is created. Now python server is not running :(
>
> $ python manage.py runsrver
> ImportError: Could not import settings 'myapp.settings' (Is it on
> sys.path?): No module named myapp.settings

I think you are calling your project, call something sensible, like
your application which is present in the installed application.

> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Satinderpal Singh

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




RE: Cannot import mypackage with code in the __init__.py file

2013-06-20 Thread Sells, Fred
Yes, the files exist and they have read access and are owned by apache.  I do 
use a symlink of "current" to point to my actual project directory to 
facilitate testing.  I ported this from 1.3 by creating a new 1.5 project and 
then moving the contents of the old to the new.  The error looks like this:
Python Path:(this is the actual data, I simplified structure in my earlier 
posts.

['/var/www/mdsdeploy/current/AccNewMdsServer',
 '/usr/lib/python26.zip',
 '/usr/lib/python2.6',
. . .

 My wsgi.conf looks like this :

WSGIScriptAlias /mdsapi 
/var/www/mdsdeploy/current/AccNewMdsServer/AccNewMdsServer/wsgi.py


WSGIPythonPath /var/www/mdsdeploy/current
WSGIPythonPath /var/www/mdsdeploy/current/AccNewMdsServer

WSGIScriptReloading On

#commented the following out until I get it to work.
#WSGIReloadMechanism Process
#WSGIDaemonProcess djangoapps processes=2 threads=15 
python-path=/home/mdsdeploy/current:/home/mdsdeploy/current/AccNewMdsServer
#WSGIProcessGroup djangoapps
LogLevel info
WSGISocketPrefix /var/run/wsgi



Order allow,deny
Allow from all




Order allow,deny
Allow from all



Order allow,deny
Allow from all




Order allow,deny
Allow from all



-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Tom Evans
Sent: Thursday, June 20, 2013 4:50 AM
To: django-users@googlegroups.com
Subject: Re: Cannot import mypackage with code in the __init__.py file

On Wed, Jun 19, 2013 at 7:51 PM, fred  wrote:
> I'm upgrading to django 1.5.1 on CentOs 6.4 with python 2.6.6  
> although I'm developing on a W7 with the django debug server.
>
> I am getting executing my view.py and most of the modules it uses.  
> But in one scenario, the import fails, see directory outline below
>
> NewMdsServer
>|___NewMdsServer
>   |___settings.py
>   |___wsgi.py
>   |___ ...
>|___app
> |___views.py
> |___mymodule.py
> |___mypackage
>|___  __init__.py
>|___  x.py
>|___  y.py
>
> I have code in the __init__.py which then imports x, y, etc

Do the files NewMdsServer/NewMdsServer/__init__.py and 
NewMdsServer/app/__init__.py exist?

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: autogenerating SECRET_KEY every time the server runs

2013-06-20 Thread Tom Evans
On Thu, Jun 20, 2013 at 4:29 PM, Michael Cetrulo  wrote:
> considering that the SECRET_KEY is automatically generated every time a new
> project is created [1], wouldn't make more sense to have this logic on
> settings.py and generate a new value when loading the app instead of saving
> it as an actual hardcoded value there? eg:
>
> #settings.py
>
> from django.utils.crypto import get_random_string
> chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
> SECRET_KEY = get_random_string(50, chars)
>
> is there any problems I'm not considering here? thanks.
>
> [1]
> https://github.com/django/django/blob/master/django/core/management/commands/startproject.py
>

SECRET_KEY is used in lots of places in django where you need a non
changing salt. For instance, if you use a signed cookies as a session
backend, the SECRET_KEY is used as part of the signing key.

Therefore, every time you change the SECRET_KEY, you invalidate all
previously signed contents. This would make it beyond useless for
signing purposes.

The only other use of SECRET_KEY in django itself is as the default
encryption secret. Again, the same problem applies - if you change
SECRET_KEY on startup, you will no longer be able to decrypt things
you encrypted earlier.

I don't see what benefit you are trying to get by cycling SECRET_KEY.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




autogenerating SECRET_KEY every time the server runs

2013-06-20 Thread Michael Cetrulo
considering that the SECRET_KEY is automatically generated every time a new 
project is created [1], wouldn't make more sense to have this logic on 
settings.py and generate a new value when loading the app instead of saving 
it as an actual hardcoded value there? eg:

#settings.py

from django.utils.crypto import get_random_string
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
SECRET_KEY = get_random_string(50, chars)

is there any problems I'm not considering here? thanks.

[1] 
https://github.com/django/django/blob/master/django/core/management/commands/startproject.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: autogenerating SECRET_KEY every time the server runs

2013-06-20 Thread Oscar Carballal
So the SECRET_KEY is stored in the database at syncdb time? What if it gets
compromised, you need to modify that table/row? Just asking out of
curiosity :-)


2013/6/20 John DeRosa 

> When we run the development server locally, we often start with an
> already-existing database. We don't re-initialize the db unless we have to,
> because there's been a schema change or a change in the value stored in a
> table's field.
>
> So we'd need SECRET_KEY to not change most of the time!
>
> John
>
> On Jun 20, 2013, at 8:29 AM, Michael Cetrulo  wrote:
>
> considering that the SECRET_KEY is automatically generated every time a
> new project is created [1], wouldn't make more sense to have this logic on
> settings.py and generate a new value when loading the app instead of saving
> it as an actual hardcoded value there? eg:
>
> #settings.py
>
> from django.utils.crypto import get_random_string
> chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
> SECRET_KEY = get_random_string(50, chars)
>
> is there any problems I'm not considering here? thanks.
>
> [1]
> https://github.com/django/django/blob/master/django/core/management/commands/startproject.py
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: autogenerating SECRET_KEY every time the server runs

2013-06-20 Thread John DeRosa
When we run the development server locally, we often start with an 
already-existing database. We don't re-initialize the db unless we have to, 
because there's been a schema change or a change in the value stored in a 
table's field.

So we'd need SECRET_KEY to not change most of the time!

John

On Jun 20, 2013, at 8:29 AM, Michael Cetrulo  wrote:

> considering that the SECRET_KEY is automatically generated every time a new 
> project is created [1], wouldn't make more sense to have this logic on 
> settings.py and generate a new value when loading the app instead of saving 
> it as an actual hardcoded value there? eg:
> 
> #settings.py
> from django.utils.crypto import get_random_string
> chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
> SECRET_KEY = get_random_string(50, chars)
> 
> is there any problems I'm not considering here? thanks.
> 
> [1] 
> https://github.com/django/django/blob/master/django/core/management/commands/startproject.py
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django polls application problem

2013-06-20 Thread Ernest Mundia
Hi Kamal,

I am also new to django, but it looks like you misspelled server in
runserver, could you maybe just check that you typed it in correctly as in
$ python manage.py runserver


On Thu, Jun 20, 2013 at 4:26 PM, Kamal Kaur  wrote:

> I am new to Django. Creating my first application, Polls. Some field was
> missing in database when I tried to enter multiple
> choices in a poll from terminal. Even it was not done when admin.py
> file was changed to show a bunch of choices. Now previous database is
> dropped and a new one is created. Now python server is not running :(
>
> $ python manage.py runsrver
> ImportError: Could not import settings 'myapp.settings' (Is it on
> sys.path?): No module named myapp.settings
>
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Ernest Mundia
"Keep lookingDon't settle"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: user authentication with extended (AbstractUser) user model

2013-06-20 Thread Evan Stone
Thanks for opening the ticket and thanks so much for the explanation as 
well! 


-evan


On Wednesday, June 19, 2013 7:13:04 PM UTC-5, Russell Keith-Magee wrote:
>
>
> On Thu, Jun 20, 2013 at 4:16 AM, Evan Stone  > wrote:
>
>> Sure thing. Here are the snippets that gave me pause:
>>
>> "Think carefully before handling information not directly related to 
>> authentication in your custom User Model.
>>
>> It may be better to store app-specific user information in a model that 
>> has a relation with the User model. That allows each app to specify its own 
>> user data requirements without risking conflicts with other apps"
>>
>> along with
>>
>> "One limitation of custom User models is that installing a custom User 
>> model will break any proxy model extending 
>> User.
>>  
>> ..."
>>
>> and
>>
>> "Another limitation of custom User models is that you can’t use 
>> django.contrib.auth.get_user_model()
>>  as 
>> the sender or target of "
>>
>>
>> Thanks for giving those details. I've opened ticket #20629 [1] to track 
> this problem -- hopefully we can get this documentation cleaned up so we 
> don't scare others in the future.
>
> [1] https://code.djangoproject.com/ticket/20629
>
> By way of explanation:
>
> Points 1 and 2 are asking you to consider an architectural question -- do 
> you need a custom user model at all? If you actually *are* using a 
> username-based login system, and you just want to track some extra 
> information about the user, the right approach may *not* be to create a 
> custom user model.
>
> Points 3 and 4 are pointing out known limitations. Proxy models are a 
> problem because they use subclassing, and they will be subclassing the 
> wrong class; signals are a problem because at the point the signal is 
> registered, there's no guarantee that the User model has been correctly 
> defined. There's not much we can do about (3); (4) is something that should 
> get cleaned up when we eventually land app refactor.
>
> Yours,
> Russ Magee %-)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Project settings and application settings.

2013-06-20 Thread Jacky Tian
Django settings are meant to be immutable, so your issues might be stemming 
from the way you're changing settings at runtime. Most Django projects that 
need to adjust settings at runtime do so by keeping the mutable settings in 
the database (e.g. a separate app in the project), so that's an approach 
you could try.

On Thursday, June 20, 2013 5:32:31 AM UTC-4, pii...@gmail.com wrote:
>
> Hello all,
>
> I want to have an application settings modifying the project settings but 
> it doesn't seems to work.
>
> For development purpose I need to authenticate users against my 
> application database. In Production
> the authentication is done by Apache, it then sends the REMOTE_USER, 
> correctly.
>
> To realize the authentication in production, i am using one middleware, 
> and one backend as found in
> django documentation.
>
> I would like to have only one setting in the project thesite/settings.py, 
> a boolean called EXTERNAL_AUTH,
> controling the content of AUTHENTICATION_BACKENDS and MIDDLEWARE_CLASSES.
>
> The code modifying those two variables will stand in my application 
> my/settings.py, It would then look like this
>
> from django.conf import settings
> if settings.EXTERNAL_AUTH == False:
> # Disabling standard login/logout.
> settings.LOGIN_REDIRECT_URL='/'
> settings.LOGIN_URL='/my/accounts/login/'
> settings.LOGOUT_URL='/my/accounts/logout/'
> else:
> settings.AUTHENTICATION_BACKENDS = (
> ('my.backends.LDAPUserBackend', ) +
> settings.AUTHENTICATION_BACKENDS)
>
> # Insert LDAPUserMiddleware right after AuthenticationMiddleware
> index = settings.MIDDLEWARE_CLASSES.index(
> "django.contrib.auth.middleware.AuthenticationMiddleware")
> settings.MIDDLEWARE_CLASSES = (settings.MIDDLEWARE_CLASSES[:index+1] +
> ('my.backends.LDAPUserMiddleware', ) +
> settings.MIDDLEWARE_CLASSES[index+1:])
>
> EXTERNAL_AUTH is used at different locations in my application, for 
> example I use it to decide whether or not
> I display the "change password" link.
>
> When I start testing, toggling EXTERNAL_AUTH, the behavior is fuzzy. It 
> inconsitently redirect me to the accounts/login
> even if I'm authenticated through apache. I guess the middleware isn't 
> called but when I raise an error, the debug page
> contradicts this.
>
> I'm a bit lost. Do you have any hint?
>
> Regards,
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django import error (Please reply soon)

2013-06-20 Thread Jacky Tian
Add 'myapp' to your INSTALLED_APPS in settings.py, right now Django doesn't 
know that myapp is an existing package.

On Thursday, June 20, 2013 3:06:12 AM UTC-4, sanju wrote:
>
>
>
> Hi I have problems with import error in django. Tried looking 
>
> into all possible solutions in Google, but in vain.I am posting my files 
>
> here.Please look into it and correct it as soon as possible.Thanks in 
> Advance!
>
> This is my hierarchy:
> c:/Users/Sanju/
>
> mysite
>-myapp
>  -> _init_.py
>  -> models.py
>  -> views.py
>  -> test.py
>-mysite 
>  -> settings.py
>  -> urls.py
>  -> wsgi.py
>-manage.py
>
> Contents of manage.py
>
> #!/usr/bin/env python
> import os
> import sys
>
> if __name__ == "__main__":
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", 
>
> "mysite.settings")
>
> from django.core.management import 
>
> execute_from_command_line
>
> execute_from_command_line(sys.argv)
>
> sys.path.insert(0,'C:\Users\Sanju\mysite' )
>
>
> Contents of settings.py
>
> # Django settings for mysite project.
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> # ('Your Name', 'your_...@example.com '),
> )
>
> MANAGERS = ADMINS
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql', # Add 
>
> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'mydemodb',  # Or path to database 
>
> file if using sqlite3.
> # The following settings are not used with sqlite3:
> 'USER': 'root',
> 'PASSWORD': '',
> 'HOST': '',  # Empty for localhost through 
>
> domain sockets or '127.0.0.1' for localhost through TCP.
> 'PORT': '',  # Set to empty string for default.
> }
> }
>
> # Hosts/domain names that are valid for this site; required if 
>
> DEBUG is False
> # See 
>
> https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-
>
> hosts
> ALLOWED_HOSTS = []
>
> # Local time zone for this installation. Choices can be found here:
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating 
>
> systems.
> # In a Windows environment this must be set to your system time 
>
> zone.
> TIME_ZONE = 'America/Chicago'
>
> # Language code for this installation. All choices can be found 
>
> here:
> # http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so 
>
> as not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # If you set this to False, Django will not format dates, numbers 
>
> and
> # calendars according to the current locale.
> USE_L10N = True
>
> # If you set this to False, Django will not use timezone-aware 
>
> datetimes.
> USE_TZ = True
>
> # Absolute filesystem path to the directory that will hold user-
>
> uploaded files.
> # Example: "/var/www/example.com/media/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make 
>
> sure to use a
> # trailing slash.
> # Examples: "http://example.com/media/;, 
>
> "http://media.example.com/;
> MEDIA_URL = ''
>
> # Absolute path to the directory static files should be collected 
>
> to.
> # Don't put anything in this directory yourself; store your static 
>
> files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/var/www/example.com/static/"
> STATIC_ROOT = ''
>
> # URL prefix for static files.
> # Example: "http://example.com/static/;, 
>
> "http://static.example.com/;
> STATIC_URL = '/static/'
>
> # Additional locations of static files
> STATICFILES_DIRS = (
> # Put strings here, like "/home/html/static" or 
>
> "C:/www/django/static".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> # List of finder classes that know how to find static files in
> # various locations.
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> #'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = 'w07((nih+vm%^j1i$t3ewrrt*)!+%odi
>
> $_&4=w5'
>
> # List of callables that know how to import templates from 
>
> various sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> # Uncomment the next line for simple clickjacking protection:
> # 

Django polls application problem

2013-06-20 Thread Kamal Kaur
I am new to Django. Creating my first application, Polls. Some field was 
missing in database when I tried to enter multiple 
choices in a poll from terminal. Even it was not done when admin.py 
file was changed to show a bunch of choices. Now previous database is 
dropped and a new one is created. Now python server is not running :( 

$ python manage.py runsrver 
ImportError: Could not import settings 'myapp.settings' (Is it on 
sys.path?): No module named myapp.settings 

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Django ModelForm is_valid & form_valid

2013-06-20 Thread Jacob Valenta
Basically, I have a model, a ModelForm, and an UpdateView. I go to the 
UpdateView (viewing a current customer) and just hit the submit button 
(changing no data). What results is an error from the model: *Cannot assign 
None: "Customer.store" does not allow null values.* (*I do not have a field 
on the template for setting store, this should be handled and set to the 
users actie store*) This error sounds like it is from the model being 
saved, which would mean that the form was valid (right?) Well I have tried 
using things like *if form.is_valid()* and *def form_valid(self, form):* but 
neither of those blocks of code ever execute. Out of desperation, I 
overrode the post method on the view, and made a form object, and passed it 
the instance and data. The page still returns the same error about 
Customer.store does not allow null values, But *if form.is_valid()* is in 
the error traceback.

Any help would be amazing!


*models.py*
class Customer(models.Model):

# Some fields that are not relevent


store = models.ForeignKey(Store, blank=True)


*forms.py*
class CustomerInformationForm(forms.ModelForm):

class Meta:

model = Customer

 
*views.py*
class CustomerInformationView(UpdateView): 

template_name = "customers/customer_information.html 

model = Customer 

form_class = CustomerInformationForm



def form_valid(self, form): 

customer = form.save(commit=False)

customer.store = self.request.user.active_profile.store

customer.save() 

return super(CustomerInformationView, self).save(form)



def get_object(self, *args, **kwargs):

return Customer.objects.get(number=self.kwargs.get('customer_number'))  



Environment:


Request Method: POST

Django Version: 1.5.1
Python Version: 2.7.5
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'mercury.core',
 'mercury.stores',
 'mercury.customers',
 'mercury.profiles',
 'django.contrib.admin',
 'south',
 'debug_toolbar')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware',
 'mercury.profiles.middleware.ActiveProfileMiddleware')


Traceback:
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/core/handlers/base.py"
 
in get_response
  115. response = callback(request, *callback_args, 
**callback_kwargs)
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/views/generic/base.py"
 
in view
  68. return self.dispatch(request, *args, **kwargs)
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/views/generic/base.py"
 
in dispatch
  86. return handler(request, *args, **kwargs)
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/views/generic/edit.py"
 
in post
  222. return super(BaseUpdateView, self).post(request, *args, 
**kwargs)
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/views/generic/edit.py"
 
in post
  164. if form.is_valid():
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/forms/forms.py"
 
in is_valid
  126. return self.is_bound and not bool(self.errors)
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/forms/forms.py"
 
in _get_errors
  117. self.full_clean()
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/forms/forms.py"
 
in full_clean
  274. self._post_clean()
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/forms/models.py"
 
in _post_clean
  315. self.instance = construct_instance(self, self.instance, 
opts.fields, opts.exclude)
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/forms/models.py"
 
in construct_instance
  52. f.save_form_data(instance, cleaned_data[f.name])
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/db/models/fields/__init__.py"
 
in save_form_data
  466. setattr(instance, self.name, data)
File 
"/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/db/models/fields/related.py"
 
in __set__
  401. (instance._meta.object_name, 
self.field.name))

Exception Type: ValueError at /customers/1
Exception Value: Cannot assign None: "Customer.store" does not allow null 
values.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To 

Re: Django import error (Please reply soon)

2013-06-20 Thread abhijeet shete
Hi Sanju,

Whenever you create any app in django you need to add that app's name
under INSTALLED_APPS in settings.py file. It looks like you commented that
line on which you added the name of app(myapp) under INSTALLED_APPS in your
settings file. Uncomment that line and then try again hope it will work.


> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
>* #'mysite.myapp',*
> )
>
>

Regards.
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Creating database views, functions, stored procedures etc

2013-06-20 Thread akaariai
On 20 kesä, 14:32, Mark Robson  wrote:
> Hi,
>
> I've got a Django application which uses a mixture of managed and unmanaged
> models.
>
> The managed models get their tables created in the usual way, the unmanaged
> ones via a number of .sql files in the application/sql directory.
>
> This works fine, but I also have some views and user-defined functions in
> the database. Until now I've been manually creating these after
> installation.
>
> However, I'm trying to add better unit-tests, some of which will need to
> use the views and functions.
>
> I've done a lot of research and apparently drawn a blank on this. I can
> hook the post_syncdb signal in my application, but this is executed after
> syncdb, but before custom SQL has been run.
>
> Or alternatively, I could "tack on" the views and functions to one of my
> models' .sql files, and hope that it works - but of course, the views are
> executing joins, so I need the tables they depend upon to be all created
> beforehand.
>
> (NB: I'm using Postgresql, if it makes any difference)
>
> Does anyone have a suggestion for how to handle this?
>
> Thanks
>
> Mark

You will likely want to use a custom test runner. Override its
setup_databases method and run your custom SQL there.

 - Anssi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django import error (Please reply soon)

2013-06-20 Thread Gabriel
What is the command you're trying to run, and where in the file tree are
you when you do it?

- Gabe


On Thu, Jun 20, 2013 at 4:06 AM, sanju  wrote:

>
>
> Hi I have problems with import error in django. Tried looking
>
> into all possible solutions in Google, but in vain.I am posting my files
>
> here.Please look into it and correct it as soon as possible.Thanks in
> Advance!
>
> This is my hierarchy:
> c:/Users/Sanju/
>
> mysite
>-myapp
>  -> _init_.py
>  -> models.py
>  -> views.py
>  -> test.py
>-mysite
>  -> settings.py
>  -> urls.py
>  -> wsgi.py
>-manage.py
>
> Contents of manage.py
>
> #!/usr/bin/env python
> import os
> import sys
>
> if __name__ == "__main__":
> os.environ.setdefault("DJANGO_SETTINGS_MODULE",
>
> "mysite.settings")
>
> from django.core.management import
>
> execute_from_command_line
>
> execute_from_command_line(sys.argv)
>
> sys.path.insert(0,'C:\Users\Sanju\mysite' )
>
>
> Contents of settings.py
>
> # Django settings for mysite project.
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> # ('Your Name', 'your_em...@example.com'),
> )
>
> MANAGERS = ADMINS
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql', # Add
>
> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'mydemodb',  # Or path to database
>
> file if using sqlite3.
> # The following settings are not used with sqlite3:
> 'USER': 'root',
> 'PASSWORD': '',
> 'HOST': '',  # Empty for localhost through
>
> domain sockets or '127.0.0.1' for localhost through TCP.
> 'PORT': '',  # Set to empty string for default.
> }
> }
>
> # Hosts/domain names that are valid for this site; required if
>
> DEBUG is False
> # See
>
> https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-
>
> hosts
> ALLOWED_HOSTS = []
>
> # Local time zone for this installation. Choices can be found here:
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating
>
> systems.
> # In a Windows environment this must be set to your system time
>
> zone.
> TIME_ZONE = 'America/Chicago'
>
> # Language code for this installation. All choices can be found
>
> here:
> # http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so
>
> as not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # If you set this to False, Django will not format dates, numbers
>
> and
> # calendars according to the current locale.
> USE_L10N = True
>
> # If you set this to False, Django will not use timezone-aware
>
> datetimes.
> USE_TZ = True
>
> # Absolute filesystem path to the directory that will hold user-
>
> uploaded files.
> # Example: "/var/www/example.com/media/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make
>
> sure to use a
> # trailing slash.
> # Examples: "http://example.com/media/;,
>
> "http://media.example.com/;
> MEDIA_URL = ''
>
> # Absolute path to the directory static files should be collected
>
> to.
> # Don't put anything in this directory yourself; store your static
>
> files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/var/www/example.com/static/"
> STATIC_ROOT = ''
>
> # URL prefix for static files.
> # Example: "http://example.com/static/;,
>
> "http://static.example.com/;
> STATIC_URL = '/static/'
>
> # Additional locations of static files
> STATICFILES_DIRS = (
> # Put strings here, like "/home/html/static" or
>
> "C:/www/django/static".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> # List of finder classes that know how to find static files in
> # various locations.
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> #'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = 'w07((nih+vm%^j1i$t3ewrrt*)!+%odi
>
> $_&4=w5'
>
> # List of callables that know how to import templates from
>
> various sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> # Uncomment the next line for simple clickjacking protection:
> # 

Creating database views, functions, stored procedures etc

2013-06-20 Thread Mark Robson
Hi,

I've got a Django application which uses a mixture of managed and unmanaged 
models.

The managed models get their tables created in the usual way, the unmanaged 
ones via a number of .sql files in the application/sql directory.

This works fine, but I also have some views and user-defined functions in 
the database. Until now I've been manually creating these after 
installation.

However, I'm trying to add better unit-tests, some of which will need to 
use the views and functions.

I've done a lot of research and apparently drawn a blank on this. I can 
hook the post_syncdb signal in my application, but this is executed after 
syncdb, but before custom SQL has been run.

Or alternatively, I could "tack on" the views and functions to one of my 
models' .sql files, and hope that it works - but of course, the views are 
executing joins, so I need the tables they depend upon to be all created 
beforehand.

(NB: I'm using Postgresql, if it makes any difference)

Does anyone have a suggestion for how to handle this?

Thanks

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Project settings and application settings.

2013-06-20 Thread piir . dk
Hello all,

I want to have an application settings modifying the project settings but 
it doesn't seems to work.

For development purpose I need to authenticate users against my application 
database. In Production
the authentication is done by Apache, it then sends the REMOTE_USER, 
correctly.

To realize the authentication in production, i am using one middleware, and 
one backend as found in
django documentation.

I would like to have only one setting in the project thesite/settings.py, a 
boolean called EXTERNAL_AUTH,
controling the content of AUTHENTICATION_BACKENDS and MIDDLEWARE_CLASSES.

The code modifying those two variables will stand in my application 
my/settings.py, It would then look like this

from django.conf import settings
if settings.EXTERNAL_AUTH == False:
# Disabling standard login/logout.
settings.LOGIN_REDIRECT_URL='/'
settings.LOGIN_URL='/my/accounts/login/'
settings.LOGOUT_URL='/my/accounts/logout/'
else:
settings.AUTHENTICATION_BACKENDS = (
('my.backends.LDAPUserBackend', ) +
settings.AUTHENTICATION_BACKENDS)

# Insert LDAPUserMiddleware right after AuthenticationMiddleware
index = settings.MIDDLEWARE_CLASSES.index(
"django.contrib.auth.middleware.AuthenticationMiddleware")
settings.MIDDLEWARE_CLASSES = (settings.MIDDLEWARE_CLASSES[:index+1] +
('my.backends.LDAPUserMiddleware', ) +
settings.MIDDLEWARE_CLASSES[index+1:])

EXTERNAL_AUTH is used at different locations in my application, for example 
I use it to decide whether or not
I display the "change password" link.

When I start testing, toggling EXTERNAL_AUTH, the behavior is fuzzy. It 
inconsitently redirect me to the accounts/login
even if I'm authenticated through apache. I guess the middleware isn't 
called but when I raise an error, the debug page
contradicts this.

I'm a bit lost. Do you have any hint?

Regards,



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Django import error (Please reply soon)

2013-06-20 Thread sanju


Hi I have problems with import error in django. Tried looking 

into all possible solutions in Google, but in vain.I am posting my files 

here.Please look into it and correct it as soon as possible.Thanks in 
Advance!

This is my hierarchy:
c:/Users/Sanju/

mysite
   -myapp
 -> _init_.py
 -> models.py
 -> views.py
 -> test.py
   -mysite 
 -> settings.py
 -> urls.py
 -> wsgi.py
   -manage.py

Contents of manage.py

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", 

"mysite.settings")

from django.core.management import 

execute_from_command_line

execute_from_command_line(sys.argv)

sys.path.insert(0,'C:\Users\Sanju\mysite' )


Contents of settings.py

# Django settings for mysite project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 

'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mydemodb',  # Or path to database 

file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'root',
'PASSWORD': '',
'HOST': '',  # Empty for localhost through 

domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '',  # Set to empty string for default.
}
}

# Hosts/domain names that are valid for this site; required if 

DEBUG is False
# See 

https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-

hosts
ALLOWED_HOSTS = []

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating 

systems.
# In a Windows environment this must be set to your system time 

zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found 

here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so 

as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers 

and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware 

datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-

uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make 

sure to use a
# trailing slash.
# Examples: "http://example.com/media/;, 

"http://media.example.com/;
MEDIA_URL = ''

# Absolute path to the directory static files should be collected 

to.
# Don't put anything in this directory yourself; store your static 

files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://example.com/static/;, 

"http://static.example.com/;
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or 

"C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'w07((nih+vm%^j1i$t3ewrrt*)!+%odi

$_&4=w5'

# List of callables that know how to import templates from 

various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'mysite.urls'

# Python dotted path to the WSGI application used by Django's 

runserver.
WSGI_APPLICATION = 'mysite.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or 

"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
'django.contrib.auth',

Re: countries phone prefixes

2013-06-20 Thread Nigel Legg
That is cool. Nice one.

Regards,
Nigel Legg
07914 740972
http://twitter.com/nigellegg
http://uk.linkedin.com/in/nigellegg



On 20 June 2013 10:38, Roberto López López  wrote:

>
> Ok, answering my own question: django-country-dialcode
>
>
>
> On 06/20/2013 11:35 AM, Roberto López López wrote:
> > Hi,
> >
> > I need a sort of prepopulated foreign key with countries and their phone
> > prefixes, to add to my models. Does anyone know any 3rd party package or
> > service providing this? Thanks.
> >
> > Cheers,
> >
> > Roberto
> >
>
>
> --
> Kind regards,
>
> Roberto López López
>
>
> System Developer
> Parallab, Uni Computing
> Høyteknologisenteret, Thormøhlensgate 55
> N-5008 Bergen, Norway
> Tel:(+47) 555 84091
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: countries phone prefixes

2013-06-20 Thread Roberto López López

Ok, answering my own question: django-country-dialcode



On 06/20/2013 11:35 AM, Roberto López López wrote:
> Hi,
>
> I need a sort of prepopulated foreign key with countries and their phone
> prefixes, to add to my models. Does anyone know any 3rd party package or
> service providing this? Thanks.
>
> Cheers,
>
> Roberto
>


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




countries phone prefixes

2013-06-20 Thread Roberto López López
Hi,

I need a sort of prepopulated foreign key with countries and their phone
prefixes, to add to my models. Does anyone know any 3rd party package or
service providing this? Thanks.

Cheers,

Roberto

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anyone using django tabs ?

2013-06-20 Thread tony gair
The answer I think is no , ah well. 

On Thursday, 20 June 2013 09:28:39 UTC, tony gair wrote:
>
> I am trying django tabs for my site navigation and was wondering is I have 
> to list multiple tabs in the html file thats inherits from base.html
>
> {% if request.user.is_superuser %}
>  {% activetab "topnav" "home" %}
>  {% activetab "topnav" "admin" %}
> {% endif %}
>
> or can I say
> {% if request.user.is_superuser %}
>  {% activetab "topnav" "home" "topnav" "admin"%}
> {% endif %}
>
> or even 
>
> {% if request.user.is_superuser %}
>  {% activetab "home"  "admin"%}
> {% endif %}
>
> with only one navigation bar?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Anyone using django tabs ?

2013-06-20 Thread tony gair
I am trying django tabs for my site navigation and was wondering is I have 
to list multiple tabs in the html file thats inherits from base.html

{% if request.user.is_superuser %}
 {% activetab "topnav" "home" %}
 {% activetab "topnav" "admin" %}
{% endif %}

or can I say
{% if request.user.is_superuser %}
 {% activetab "topnav" "home" "topnav" "admin"%}
{% endif %}

or even 

{% if request.user.is_superuser %}
 {% activetab "home"  "admin"%}
{% endif %}

with only one navigation bar?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cannot import mypackage with code in the __init__.py file

2013-06-20 Thread Tom Evans
On Wed, Jun 19, 2013 at 7:51 PM, fred  wrote:
> I'm upgrading to django 1.5.1 on CentOs 6.4 with python 2.6.6  although I'm
> developing on a W7 with the django debug server.
>
> I am getting executing my view.py and most of the modules it uses.  But in
> one scenario, the import fails, see directory outline below
>
> NewMdsServer
>|___NewMdsServer
>   |___settings.py
>   |___wsgi.py
>   |___ ...
>|___app
> |___views.py
> |___mymodule.py
> |___mypackage
>|___  __init__.py
>|___  x.py
>|___  y.py
>
> I have code in the __init__.py which then imports x, y, etc

Do the files NewMdsServer/NewMdsServer/__init__.py and
NewMdsServer/app/__init__.py exist?

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: reverse funtion gives me url including server path

2013-06-20 Thread Tom Evans
On Wed, Jun 19, 2013 at 3:32 PM, Jiří Kupka  wrote:
> Hi! I have little trouble with reverse function in my project. When I run it
> over ./manage runserver, everything is fine - reverse gives me url in
> /page/xx format. When I run my project over apache2 using this conf file:
>
> Listen 8001
>
> 
> ServerName project.tld
> DocumentRoot "/var/www/project"
> ErrorLog /var/www/project/error.log
> CustomLog /var/www/project/access.log combined
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE settings
> PythonOption django.root /var/www/project
> PythonDebug Off
> PythonPath
> "['/var/www/','/var/www/project','/usr/local/lib/site-packages/django'] +
> sys.path"
> 
> 
>
> reverse gives me url in /var/www/project/page/xxx format ->
> http://project.tld/var/www/project/page/xxx. What is interesting, I can open
> http://project.tld/page/xxx and http://project.tld/var/www/project/page/xxx
> and I get same results, but reverese function returns "ugly" full path...
>
> Any suggestions, how can I fix it?

Don't use mod_python to serve django. Use wsgi or fcgi. From the docs:

Chapter 12 of the Django Book (second edition) discusses deployment
and especially scaling in more detail. However, note that this edition
was written against Django version 1.1 and has not been updated since
mod_python was first deprecated, then completely removed in Django
1.5.

https://docs.djangoproject.com/en/1.5/howto/deployment/

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: reverse funtion gives me url including server path

2013-06-20 Thread Jiří Kupka
Solved...
I just delete this line with PythonOption and now, everything works right.

Thanks for you advice!
Jirka

Dne čtvrtek, 20. června 2013 10:35:02 UTC+2 Jiří Kupka napsal(a):
>
> Ok, I rewrote it on PythonOption django.root /. Now, reverse returns 
> right url, but... for some reason, on every page like /page/xx I get error 
> 404. It's not only /page/xx, it's media and static files folder too. The 
> only page that works is homepage without css and js, as a result of error 
> 404 in media and static directory.
>
> Anything else, what I forgot to do?
>
> Thanks,
> Jirka
>
> Dne středa, 19. června 2013 20:19:37 UTC+2 Timster napsal(a):
>>
>> It's this line:
>>
>> PythonOption django.root /var/www/project
>>
>> Change that to / or anything else and you should be all set.
>>
>> On Wednesday, June 19, 2013 10:32:12 AM UTC-4, Jiří Kupka wrote:
>>>
>>> Hi! I have little trouble with reverse function in my project. When I 
>>> run it over ./manage runserver, everything is fine - reverse gives me url 
>>> in /page/xx format. When I run my project over apache2 using this conf file:
>>>
>>> Listen 8001
>>>
>>> 
>>> ServerName project.tld
>>> DocumentRoot "/var/www/project"
>>> ErrorLog /var/www/project/error.log
>>> CustomLog /var/www/project/access.log combined
>>> 
>>> SetHandler python-program
>>> PythonHandler django.core.handlers.modpython
>>> SetEnv DJANGO_SETTINGS_MODULE settings
>>> PythonOption django.root /var/www/project
>>> PythonDebug Off
>>> PythonPath 
>>> "['/var/www/','/var/www/project','/usr/local/lib/site-packages/django'] + 
>>> sys.path"
>>> 
>>> 
>>>
>>> reverse gives me url in /var/www/project/page/xxx format -> 
>>> http://project.tld/var/www/project/page/xxx. What is interesting, I can 
>>> open http://project.tld/page/xxx and 
>>> http://project.tld/var/www/project/page/xxx and I get same results, but 
>>> reverese function returns "ugly" full path...
>>>
>>> Any suggestions, how can I fix it?
>>>
>>> Thanks,
>>> Jirka
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: reverse funtion gives me url including server path

2013-06-20 Thread Jiří Kupka
Ok, I rewrote it on PythonOption django.root /. Now, reverse returns right 
url, but... for some reason, on every page like /page/xx I get error 404. 
It's not only /page/xx, it's media and static files folder too. The only 
page that works is homepage without css and js, as a result of error 404 in 
media and static directory.

Anything else, what I forgot to do?

Thanks,
Jirka

Dne středa, 19. června 2013 20:19:37 UTC+2 Timster napsal(a):
>
> It's this line:
>
> PythonOption django.root /var/www/project
>
> Change that to / or anything else and you should be all set.
>
> On Wednesday, June 19, 2013 10:32:12 AM UTC-4, Jiří Kupka wrote:
>>
>> Hi! I have little trouble with reverse function in my project. When I run 
>> it over ./manage runserver, everything is fine - reverse gives me url in 
>> /page/xx format. When I run my project over apache2 using this conf file:
>>
>> Listen 8001
>>
>> 
>> ServerName project.tld
>> DocumentRoot "/var/www/project"
>> ErrorLog /var/www/project/error.log
>> CustomLog /var/www/project/access.log combined
>> 
>> SetHandler python-program
>> PythonHandler django.core.handlers.modpython
>> SetEnv DJANGO_SETTINGS_MODULE settings
>> PythonOption django.root /var/www/project
>> PythonDebug Off
>> PythonPath 
>> "['/var/www/','/var/www/project','/usr/local/lib/site-packages/django'] + 
>> sys.path"
>> 
>> 
>>
>> reverse gives me url in /var/www/project/page/xxx format -> 
>> http://project.tld/var/www/project/page/xxx. What is interesting, I can 
>> open http://project.tld/page/xxx and 
>> http://project.tld/var/www/project/page/xxx and I get same results, but 
>> reverese function returns "ugly" full path...
>>
>> Any suggestions, how can I fix it?
>>
>> Thanks,
>> Jirka
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.