Re: incrementing non primary keys.

2010-12-15 Thread Hutch
Yes, the integer is needed, it's part of the spec. It's used for job
numbering. the problem being, they need not only an integer, but each
tenant needs sequential numbers.

if it was up to me, I would just remove it.

On Dec 15, 10:59 am, Eric Chamberlain  wrote:
> If you are using a UUID for the primary key, do you really need an integer?
>
> We had a similar multi-tenant need and didn't want to leak usage information 
> to the users, so we used UUID instead of auto incrementing integers.
>
> On Dec 15, 2010, at 9:23 AM, Hutch wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm porting an old php app and have run into a bit of an issue. The
> > main problem is that we this app will need to be used by multiple
> > different companies. While I could just setup discreet instances, I'm
> > thinking that making the app multi-tenant would be a much wiser idea
> > and easier on resources, as traffic will be reasonably low, maybe
> > 100-200 users a day. I also don't desire to deal with 4 installations
> > of the code, when one will do.
>
> > The specific problem I have though, is in the legacy app, the primary
> > key for a certain table is an auto incrementing integer. This needs be
> > kept separate for each tenant. What I'm planning on doing is making
> > the primary key a uuid, and using unique_together with an integer
> > field. However I could easily see a race condition with incrementing
> > the integer field. What is the best way to handle this situation?
>
> > Also, what is the best way of filtering based on the site_id? should i
> > store a setting with the session and filter based on that? I was
> > thinking about seeing if it's possible to use a middleware to change
> > it at run time based on the request url. Is that a good idea?
>
> > are there any documents on best practices for django multitenancy?
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-us...@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: Confused about thread locals... again.

2010-12-15 Thread ringemup

I faced this problem, and ran into the issue that the request object
is not passed to the template loader, so there's no way to get your
domain from within a custom template loader without using
threadlocals.

What I did instead was as follows:

1) Write a custom render-to-response type function that selects the
template using select_template based on the theme for the domain
2) Write a custom template tag that will select the correct template
for an include based on the theme, and use it instead of the standard
{% include %} tag
3) Write a custom context processor that will determine the base
template for the theme, and pass it in a base_template variable for
use in {% extends base_template %}

Note that (1) means that you will not be able to use generic views
(well, at least pre-class-based ones) or views from third-party apps.
However, depending on your theming system, you may be able to get away
with just (3) or a combination of (2) and (3).


On Dec 16, 12:17 am, "W. Craig Trader"  wrote:
> I think that the correct solution for your problem would be, instead of
> hacking around with the template path on the fly like this, to instead write
> a template loader for your application, and apply the logic you need within
> the template loader itself.
>
> See:http://docs.djangoproject.com/en/dev/ref/templates/api/#loading-templ...http://code.djangoproject.com/browser/django/trunk/django/template/lo...
> details.
>
> - Craig -
>
> On Wed, Dec 15, 2010 at 18:30, Doug Ballance  wrote:
> > First, I'd like to find out if there is a better way than thread
> > locals to do what I want to do.  From what I can tell, it isn't
> > possible any other way.   Finally, I don't understand why my thread
> > locals implementation/hack works - which scares me, so I would like to
> > ask the wiser gurus out there for an explanation.
>
> > Need: To alter the template path used by a custom template loader
> > based on the the request object.  Specifically I want to alter it
> > based on the incoming domain, and sanitized cookie value allowing
> > 'theme' selection.
>
> > I have a basic theme setup using thread locals that works.
>
> > in the same module/directory I have:
>
> > base.py -> contains the theme objects, thread locals variable, and a
> > couple of get/set functions that just use getattr/setattr to set a
> > theme attribute on the local() instance.
>
> > middleware.py -> contains the middleware that calls my "set theme"
> > function
>
> > loader.py-> contains the template loader which calls my "get theme"
> > function
>
> > The base setup works fine, but was written with the intention of
> > subclassing it for another app to set the theme according to a 'site'
> > object that gets created by another middleware (we serve multiple
> > sites from one fastcgi instance).  So I have another middleware.py
> > file in another app that imports my ThemeMiddleware and subclasses it
> > overriding the method returns the template path to cause the loader to
> > look for that sites templates.
>
> > This does not work.  I get two different thread locals instances
> > (print shows different addresses), despite all manipulation of the
> > local variable happening in base.py just as it did in the working
> > version.
>
> > I've had issues in the past with thread locals working differently
> > depending on module import method.  So I stripped out the thread
> > locals bit from base.py and put in all by itself in thread_locals.py:
>
> > ---
> > try:
> >    from threading import local
> > except ImportError:
> >    from django.utils._threading_local import local
> > thread_local=local()
> > 
>
> > Now in base.py I added 'from thread_locals import thread_local' at the
> > top of the module, and nothing else changes.  I was hoping that the
> > same import statment (it's only imported once, in one file) would
> > bypass the problem, but it doesn't.
>
> > Next I moved the thread_locals.py file from the same directory as my
> > other theme files to the project root, in the same location as
> > django's settings.py.  No other changes were made.
>
> > It works.
>
> > I should be happy, but I'm not comfortable allowing solutions I don't
> > reasonably understand to go into production.  I'd love to drop thread
> > locals entirely, but short of that some understanding of what is
> > happening and why would be a big help.  I googled the heck out if it,
> > but didn't find anything that fit.
>
> > 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-us...@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 

problem with multiple Foreignkeys in ModelForm

2010-12-15 Thread Patrick
I'm getting the following error:
annot assign "": "Bid.bidder" must be a "Bidder" instance.

#classes
class Listing(models.Model):
owner  = models.ForeignKey(User, verbose_name=_('Im the wanter'))
title  = models.CharField(_('short description'), max_length=255)

class Bidder(models.Model):
user = models.ForeignKey(User, verbose_name=_('bidder'),
unique=True)

class Bid(models.Model):
listing = models.ForeignKey(Listing)
bidder = models.ForeignKey(Bidder)
bidding_price = models.DecimalField(_('offering bid',),
max_digits=6, decimal_places=2,blank=True, null=False)

#form
class BidForm(forms.ModelForm):
class Meta:
model = Bid
exclude = ('bidder', 'listing',)
#view
@login_required
def newbid(request,listing_id):
''' Create a new bid with request.user as owner
'''
if request.method == 'POST':
form = BidForm(request.POST)
if form.is_valid:
bid=form.save(commit=False)
bidder_person=Bidder(user = request.user)
bidder_person.save()

bid.bidder = bidder_person #problem is here!

l = get_object_or_404(Listing, pk=listing_id)
bid.listing = l
bid.listing.owner = l.owner
bid.save()
return HttpResponseRedirect(reverse('listings_all'))

else:
form = BidForm()

return create_object(
request,
form_class = BidForm
)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Getting 'specified module cannot be found' error when synching model to DB

2010-12-15 Thread W. Craig Trader
It sounds like you have a Windows and/or Python path problem.  The DLL
that's being loaded (kernel32.dll?) isn't on the Windows path (or in the
Python lib directory) when Python is attempting to load it.  Certainly
nothing to do with Django.  What version of Python are you using?

- Craig -

On Wed, Dec 15, 2010 at 14:12, Charlie  wrote:

> I've set up a PostgreSQL/PostGIS spatial database, and created
> settings and model files for a new project.  When I try to synch the
> model with the DB, I get the following error message (last lines
> only):
>
>  File "c:\Python26\lib\ctypes\__init__.py", line 355, in __init__
>self._handle = _dlopen(self._name, mode)
> WindowsError: [Error 126] The specified module could not be found
>
> I ran a print statement in the __init__py file and found that the
> module they're referring to is kernel32.  Can anyone provide any
> insight into this?
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Confused about thread locals... again.

2010-12-15 Thread W. Craig Trader
I think that the correct solution for your problem would be, instead of
hacking around with the template path on the fly like this, to instead write
a template loader for your application, and apply the logic you need within
the template loader itself.

See:
http://docs.djangoproject.com/en/dev/ref/templates/api/#loading-templatesand
http://code.djangoproject.com/browser/django/trunk/django/template/loader.pyfor
details.

- Craig -

On Wed, Dec 15, 2010 at 18:30, Doug Ballance  wrote:

> First, I'd like to find out if there is a better way than thread
> locals to do what I want to do.  From what I can tell, it isn't
> possible any other way.   Finally, I don't understand why my thread
> locals implementation/hack works - which scares me, so I would like to
> ask the wiser gurus out there for an explanation.
>
> Need: To alter the template path used by a custom template loader
> based on the the request object.  Specifically I want to alter it
> based on the incoming domain, and sanitized cookie value allowing
> 'theme' selection.
>
> I have a basic theme setup using thread locals that works.
>
> in the same module/directory I have:
>
> base.py -> contains the theme objects, thread locals variable, and a
> couple of get/set functions that just use getattr/setattr to set a
> theme attribute on the local() instance.
>
> middleware.py -> contains the middleware that calls my "set theme"
> function
>
> loader.py-> contains the template loader which calls my "get theme"
> function
>
> The base setup works fine, but was written with the intention of
> subclassing it for another app to set the theme according to a 'site'
> object that gets created by another middleware (we serve multiple
> sites from one fastcgi instance).  So I have another middleware.py
> file in another app that imports my ThemeMiddleware and subclasses it
> overriding the method returns the template path to cause the loader to
> look for that sites templates.
>
> This does not work.  I get two different thread locals instances
> (print shows different addresses), despite all manipulation of the
> local variable happening in base.py just as it did in the working
> version.
>
> I've had issues in the past with thread locals working differently
> depending on module import method.  So I stripped out the thread
> locals bit from base.py and put in all by itself in thread_locals.py:
>
> ---
> try:
>from threading import local
> except ImportError:
>from django.utils._threading_local import local
> thread_local=local()
> 
>
> Now in base.py I added 'from thread_locals import thread_local' at the
> top of the module, and nothing else changes.  I was hoping that the
> same import statment (it's only imported once, in one file) would
> bypass the problem, but it doesn't.
>
> Next I moved the thread_locals.py file from the same directory as my
> other theme files to the project root, in the same location as
> django's settings.py.  No other changes were made.
>
> It works.
>
> I should be happy, but I'm not comfortable allowing solutions I don't
> reasonably understand to go into production.  I'd love to drop thread
> locals entirely, but short of that some understanding of what is
> happening and why would be a big help.  I googled the heck out if it,
> but didn't find anything that fit.
>
> 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-us...@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-us...@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: newbie problem with accepting form input

2010-12-15 Thread john doe
On Wed, Dec 15, 2010 at 3:06 AM, Jer-ming Lin  wrote:

> it seems the name conflict is the real problem. maybe you can use
> "Form Prefix"
> http://docs.djangoproject.com/en/1.2/ref/forms/api/#prefixes-for-forms
> to differentiate the fields between the Report and Incident Form.
> Sorry i can not help you totally and i also have no time to test it.
> Hope you can feedback this.
>
> Thanks again :-)

I gave up on the form validation and went through to analyzing the input via
the raw unicode in request.POST itself.
Not ideal, but its at least a way for me to move forward.

BR
> Jer-ming
>
> 2010/12/15 john doe :
> >
> >
> > On Tue, Dec 14, 2010 at 9:17 PM, john doe <
> thebiggestbangthe...@gmail.com>
> > wrote:
> >>
> >>
> >> On Tue, Dec 14, 2010 at 2:15 PM, Titan, Jer-ming Lin  >
> >> wrote:
> >>>
> >>> maybe your view function gets wrong. post it! XDD
> >
> > looking at the request.POST itself I see:
> > [code]
> >  > 07:02:26'], u'description': [u'efff'], u'most_recent_followup_date':
> > [u'-01-01 00:00:00', u'-01-01 00:00:00'], u'harmscore': [u'1'],
> > u'acknowledgement_date': [u'-01-01 00:00:00', u'-01-01
> 00:00:00'],
> > u'submitter': [u'Anonymous'], u'type': [u'BR', u'SF'],
> u'resolution_date':
> > [u'-01-01 00:00:00', u'-01-01 00:00:00']}>
> > [/code]
> >
> > which shows the type choices for report and incident as BR and SF
> >
> > Report type can be BR and UN, is this because when django sees incident
> type
> > as SF it says that it is not a valid choice?
> > Any advice will be great.
> >
> >>>
> >> Thanks Titan :-). The code I use for my view function is below
> >> [code]
> >> #validate user
> >> def check_user_login(request):
> >>   username = request.POST['username']
> >>   password = request.POST['password']
> >>   #bad practice, think about salting passwords
> >>   user = authenticate(username=username, password=password)
> >>   if user is not None:
> >>   if user.is_active:
> >>   #prepare list of reports to be shown
> >>   latest_incidentreporter_list =
> >>
> Report.objects.all().filter(submitter__iexact=username).order_by('-submission_date')
> >>   #throw in a form so that user can enter a new report
> >>   rform = ReportForm()
> >>   report = Report()
> >>   report=initializeobject(report,'r')
> >>   rform = ReportForm(instance=report)
> >>   iform = IncidentForm()
> >>   incident = Incident()
> >>   incident=initializeobject(incident,'i')
> >>   iform = IncidentForm(instance=incident)
> >>   return render_to_response('index.html',
> >> {'latest_incidentreporter_list': latest_incidentreporter_list,
> >> 'new_report_form':rform, 'new_incident_form':iform,'username':username})
> >>   else:
> >>   return render_to_response('userlogin.html', {'User': user})
> >>   # Return a 'disabled account' error message
> >>   else:
> >>   return render_to_response('userlogin.html')
> >>   # Return an 'invalid login' error message.
> >>
> >> #initialize report or instance
> >> def initializeobject(object, level):
> >>   #not sure if I have to initialize the type of object here
> >>   object.submission_date=datetime.datetime.now()
> >>   object.acknowledgement_date=datetime.datetime(datetime.MAXYEAR, 1, 1)
> >>   object.most_recent_followup_date=datetime.datetime(datetime.MAXYEAR,
> 1,
> >> 1)
> >>   object.resolution_date=datetime.datetime(datetime.MAXYEAR, 1, 1)
> >>   object.resolved=False
> >>   return object
> >> [/code]
> >>
> >> and in my models.py I have
> >> [code]
> >> class ReportForm(ModelForm):
> >>   class Meta:
> >> model=Report
> >>
> >> class IncidentForm(ModelForm):
> >>   class Meta:
> >> model=Incident
> >> [/code]
> >>>
> >>> BR
> >>> Titan
> >>>
> >>> On Dec 15, 1:50 am, john doe  wrote:
> >>> > On Tue, Dec 14, 2010 at 9:19 AM, john doe
> >>> > wrote:
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > > On Tue, Dec 14, 2010 at 5:16 AM, Jer-ming Lin 
> >>> > > wrote:
> >>> >
> >>> > >> Hi John,
> >>> >
> >>> > >>plz modify the Incident Model like Report Model,
> >>> >
> >>> > >> class Incident(models.Model):
> >>> > >>   report = models.ForeignKey(Report)
> >>> > >>   INCIDENT_CHOICES = (
> >>> > >>  ('SF', 'SegFault'),
> >>> > >> ('ML', 'Memory Leak'),
> >>> > >> ('MC', 'Memory Corruption'),
> >>> > >>  )
> >>> > >>   type = models.CharField(max_length=2, choices=INCIDENT_CHOICES)
> >>> >
> >>> > >> Thanks again. I made the modification, yet I still get the error
> >>> > >> "Select a
> >>> > > valid choice. SF is not one of the available choices." !
> >>> > > Could it be that when the form is accepting input it is getting
> >>> > > confused
> >>> > > because the report has a type attribute and so does the incident.
> >>> >
> >>> > Digging  bit 

Re: Developing a search engine

2010-12-15 Thread Christophe Pettus

On Dec 15, 2010, at 5:57 PM, Sam Lai wrote:
> If you're using MySQL, Django can interface with its FTS component -
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#search

PostgreSQL also has a very good built-in full text search function.  You'll 
need to write a tiny bit of raw SQL, but you can use it with the new .raw() 
query sets.

http://www.postgresql.org/docs/9.0/interactive/textsearch.html

--
-- Christophe Pettus
   x...@thebuild.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: running projects on the back of a base URL and having issues with the homepage

2010-12-15 Thread Graham Dumpleton
'Criticism' is such a negative sounding word. :-(

On Thursday, December 16, 2010 10:59:15 AM UTC+11, Craig Trader wrote:
>
> Graham ...
>
> I appreciate the criticism -- I had to build for both mod_python and 
> mod_wsgi and there was some bleed through.
>
> - Craig -
>
> On Wed, Dec 15, 2010 at 17:11, Graham Dumpleton wrote:
>
>>
>>
>> On Wednesday, December 15, 2010 11:10:06 PM UTC+11, Craig Trader wrote:
>>
>>> Here's how I solved this problem for my own applications.  Note that I 
>>> use VirtualEnv to ensure that each application gets exactly the Python 
>>> environment I want it to have.  If you don't use VirtualEnv, it will make 
>>> the WSGI startup script simpler.  Assume that my application is installed 
>>> with the following layout:
>>>
>>> /data/web/foo/ -- base directory for foo (and the root of a VirtualEnv 
>>> environment)
>>> bin/ -- VirtualEnv scripts, including 'python' symlink
>>> lib/ -- Python libraries, including Django
>>> apache/apache.wsgi -- Apache WSGI startup script
>>> site/foo -- where the Foo site is installed (containing applications 
>>> like bar, baz, etc.)
>>> site/foo/static -- where static content is stored
>>> 
>>> First, the Apache virtual host configuration:
>>>
>>>  
>>>   ServerName foo.example.com
>>>   ServerAdmin f@example.com
>>>
>>>   ServerSignature email
>>>
>>>   LogLevel debug
>>>
>>>   WSGIProcessGroup  foo
>>>   WSGIDaemonProcess foo processes=2 threads=5 home=/data/web/foo 
>>> display-name=foo
>>>
>>>   DocumentRoot /var/www
>>>
>>>   WSGIScriptAlias / /data/web/foo/apache/django.wsgi
>>>   
>>> Order allow,deny
>>> Allow from all
>>>   
>>>
>>>   Alias /static/ /data/web/foo/site/foo/static/
>>>   
>>> SetHandler None
>>>
>>
>> Don't need this SetHandler directive. That was need for mod_python but not 
>> with mod_wsgi.
>>  
>>
>>> Order allow,deny
>>> Allow from all
>>>   
>>> 
>>>
>>> And now the WSGI startup script (most of this is just to make VirtualEnv 
>>> work):
>>>
>>> import os, sys, site 
>>>
>>> here = os.path.abspath( os.curdir )
>>>
>>
>> From here:
>>  
>>
>>>
>>> ALLDIRS = [ 
>>> os.path.join( here, 'site' ),
>>> os.path.join( here, 'lib', 'python2.6', 'site-packages' ),
>>> ]
>>>
>>> # Remember original sys.path.
>>> prev_sys_path = list(sys.path) 
>>>
>>> # Add each new site-packages directory.
>>> for directory in ALLDIRS:
>>>   site.addsitedir(directory)
>>>
>>> # Reorder sys.path so new directories at the front.
>>> new_sys_path = [] 
>>> for item in list(sys.path): 
>>> if item not in prev_sys_path: 
>>> new_sys_path.append(item) 
>>> sys.path.remove(item) 
>>> sys.path[:0] = new_sys_path 
>>>
>>
>> to here, should be able to be simplified to:
>>
>>   activate = os.path.join(here, 'bin', 'activate_this.py')
>>   execfile(activate, dict(__file__=activate))
>>
>>   sys.path.insert(0, os.path.join(here, 'site'))
>>
>> I no longer object to the activate_this.py script even though it modifies 
>> sys.prefix. Although technically that could be problematic, hasn't shown 
>> itself to be in practice.
>>
>> Graham
>>  
>>
>>>
>>> os.environ['DJANGO_SETTINGS_MODULE'] = 'foo.settings'
>>>
>>> import django.core.handlers.wsgi
>>> application = django.core.handlers.wsgi.WSGIHandler()
>>>
>>> In my settings.py file, I have the following:
>>>
>>> import os, sys
>>>
>>> SITEDIR = os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) ) 
>>> )
>>>
>>> MEDIA_ROOT = os.path.join( SITEDIR, 'foo', 'static' )
>>> MEDIA_URL = '/static/'
>>> ADMIN_MEDIA_PREFIX = '/media/'
>>>
>>> ROOT_URLCONF = 'foo.urls'
>>>
>>> TEMPLATE_DIRS = ( 
>>> os.path.join( SITEDIR, 'foo', 'templates' ),
>>> )
>>>
>>> INSTALLED_APPS = ( 
>>> 'django.contrib.auth',
>>> 'django.contrib.contenttypes',
>>> 'django.contrib.sessions',
>>> 'django.contrib.sites',
>>> 'django.contrib.messages',
>>> 'django.contrib.admin',
>>> 'foo.bar',
>>> 'foo.baz',
>>> )
>>>
>>> My urls.py file looks like this:
>>>
>>> from django.conf import settings
>>> from django.conf.urls.defaults import *
>>> from django.contrib import admin
>>> from django.shortcuts import render_to_response
>>>
>>> # Uncomment the next two lines to enable the admin:
>>> admin.autodiscover()
>>>
>>> def home( *args, **options ):
>>> return render_to_response( 'index.html' )
>>>
>>> urlpatterns = patterns( '',
>>> url( r'^$', home, name='site_index' ),
>>> ( r'^admin/', include( admin.site.urls ) ),
>>> ( r'^foo include( 'stackexchange.foo.urls' ) ),
>>> ( r'^bar include( 'stackexchange.bar.urls' ) ),
>>> ( r'^static/(?P.*)$', 'django.views.static.serve',
>>> {'document_root': settings.MEDIA_ROOT } ),
>>>  )
>>>
>>> You only need the 'static' definition for when you're testing using 
>>> 'runserver'; Apache intercepts all of the /static/ URLs before Django sees 
>>> them in production.
>>>
>>> I hope this helps.
>>>
>>> - Craig -

Re: Unclear about my membership status

2010-12-15 Thread Kenneth Gonsalves
On Wed, 2010-12-15 at 18:18 -0500, Shawn Milochik wrote:
> It looks like your earlier post made it in:
> 
> http://groups.google.com/group/django-users/browse_thread/thread/3157104d4334a643
> 
> Also, (obviously), this post of yours showed up. I'd say you're
> properly a member. 

looks like it
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Need Django open-source project for Classifieds website.

2010-12-15 Thread Rehmetjan
i want to build a classifieds website like Craigslist.com  with
Django, (or http://www.dubizzle.com/).
anybody knows where can I find it? or suggest.. thanks all.

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



Re: Developing a search engine

2010-12-15 Thread Sam Lai
On 16 December 2010 08:56, marcoarreguin  wrote:
> I'm trying to make a search engine with my database, parsing de text
> that the user write in the textbox to make a list with the cleaned
> words, in just one table of the DB in the fields: title, descripcion
> and tags, I have something like this but I don't know how to finish
> it:

You're trying to do what's called full text search (FTS), and
databases out of the box are horrible at doing that (i.e. without the
FTS components). You'll run into all kinds of issues trying to
construct the query, and the performance will be bad.

If you're using MySQL, Django can interface with its FTS component -
http://docs.djangoproject.com/en/dev/ref/models/querysets/#search

Otherwise, I suggest using one of the open source search engines
(Solr, Whoosh, Xapian etc.) and using Haystack to connect it to
Django. Whoosh is a nice, easy choice and works for sites with small
amounts of traffic.

http://haystacksearch.org/

>
> from django.http import HttpResponse
> from django.shortcuts import render_to_response
> from myproject.parsing.models import Stores
> from pyparsing import *
> from django.db.models import Q
>
> def search_form(request):
>    return render_to_response('search_form.html')
>
> def search(request):
>        errors= []
>        if 'q' in request.GET:
>                q = request.GET['q']
>        if not q:
>                errors.append('Write something')
>        else:
>                qclean= parseText(q)
>                for Word in qclean:
>                        Foundstores = 
> Stores.objects.filter(Q(name__icontains=Word) |
> Q(description__icontains=Word) | Q(tags__icontains=Word))
>
>                        #But remeber that I have more than one word,
> so I need to concatenate all the querysets of each one of the words in
> qclean
>
>                return render_to_response('search_results.html', {'Found':
> Foundstores, 'query': qclean})
>
>        return render_to_response('search_form.html', {'errors': errors})
>
>
>
> def parseText(texto):
>        parser=OneOrMore(Word(alphas))
>        #articles in spanish
>        arreglo=("de","en","la")
>        for articulo in arreglo:
>                parser.ignore(CaselessLiteral(articulo))
>        salida=parser.parseString(texto)
>        return salida
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Django-Facebook (yet another thread)

2010-12-15 Thread Justin Murphy
Facebook published a sample GAE application. The code is pretty
straightforward and you can pretty much use the same concepts in your
Django code. I would think that the signed request logic would work
best in middleware.

https://github.com/facebook/runwithfriends

-Justin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: running projects on the back of a base URL and having issues with the homepage

2010-12-15 Thread W. Craig Trader
Graham ...

I appreciate the criticism -- I had to build for both mod_python and
mod_wsgi and there was some bleed through.

- Craig -

On Wed, Dec 15, 2010 at 17:11, Graham Dumpleton
wrote:

>
>
> On Wednesday, December 15, 2010 11:10:06 PM UTC+11, Craig Trader wrote:
>
>> Here's how I solved this problem for my own applications.  Note that I use
>> VirtualEnv to ensure that each application gets exactly the Python
>> environment I want it to have.  If you don't use VirtualEnv, it will make
>> the WSGI startup script simpler.  Assume that my application is installed
>> with the following layout:
>>
>> /data/web/foo/ -- base directory for foo (and the root of a VirtualEnv
>> environment)
>> bin/ -- VirtualEnv scripts, including 'python' symlink
>> lib/ -- Python libraries, including Django
>> apache/apache.wsgi -- Apache WSGI startup script
>> site/foo -- where the Foo site is installed (containing applications
>> like bar, baz, etc.)
>> site/foo/static -- where static content is stored
>>
>> First, the Apache virtual host configuration:
>>
>> 
>>   ServerName foo.example.com
>>   ServerAdmin f...@example.com
>>
>>   ServerSignature email
>>
>>   LogLevel debug
>>
>>   WSGIProcessGroup  foo
>>   WSGIDaemonProcess foo processes=2 threads=5 home=/data/web/foo
>> display-name=foo
>>
>>   DocumentRoot /var/www
>>
>>   WSGIScriptAlias / /data/web/foo/apache/django.wsgi
>>   
>> Order allow,deny
>> Allow from all
>>   
>>
>>   Alias /static/ /data/web/foo/site/foo/static/
>>   
>> SetHandler None
>>
>
> Don't need this SetHandler directive. That was need for mod_python but not
> with mod_wsgi.
>
>
>> Order allow,deny
>> Allow from all
>>   
>> 
>>
>> And now the WSGI startup script (most of this is just to make VirtualEnv
>> work):
>>
>> import os, sys, site
>>
>> here = os.path.abspath( os.curdir )
>>
>
> From here:
>
>
>>
>> ALLDIRS = [
>> os.path.join( here, 'site' ),
>> os.path.join( here, 'lib', 'python2.6', 'site-packages' ),
>> ]
>>
>> # Remember original sys.path.
>> prev_sys_path = list(sys.path)
>>
>> # Add each new site-packages directory.
>> for directory in ALLDIRS:
>>   site.addsitedir(directory)
>>
>> # Reorder sys.path so new directories at the front.
>> new_sys_path = []
>> for item in list(sys.path):
>> if item not in prev_sys_path:
>> new_sys_path.append(item)
>> sys.path.remove(item)
>> sys.path[:0] = new_sys_path
>>
>
> to here, should be able to be simplified to:
>
>   activate = os.path.join(here, 'bin', 'activate_this.py')
>   execfile(activate, dict(__file__=activate))
>
>   sys.path.insert(0, os.path.join(here, 'site'))
>
> I no longer object to the activate_this.py script even though it modifies
> sys.prefix. Although technically that could be problematic, hasn't shown
> itself to be in practice.
>
> Graham
>
>
>>
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'foo.settings'
>>
>> import django.core.handlers.wsgi
>> application = django.core.handlers.wsgi.WSGIHandler()
>>
>> In my settings.py file, I have the following:
>>
>> import os, sys
>>
>> SITEDIR = os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) )
>> )
>>
>> MEDIA_ROOT = os.path.join( SITEDIR, 'foo', 'static' )
>> MEDIA_URL = '/static/'
>> ADMIN_MEDIA_PREFIX = '/media/'
>>
>> ROOT_URLCONF = 'foo.urls'
>>
>> TEMPLATE_DIRS = (
>> os.path.join( SITEDIR, 'foo', 'templates' ),
>> )
>>
>> INSTALLED_APPS = (
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.sites',
>> 'django.contrib.messages',
>> 'django.contrib.admin',
>> 'foo.bar',
>> 'foo.baz',
>> )
>>
>> My urls.py file looks like this:
>>
>> from django.conf import settings
>> from django.conf.urls.defaults import *
>> from django.contrib import admin
>> from django.shortcuts import render_to_response
>>
>> # Uncomment the next two lines to enable the admin:
>> admin.autodiscover()
>>
>> def home( *args, **options ):
>> return render_to_response( 'index.html' )
>>
>> urlpatterns = patterns( '',
>> url( r'^$', home, name='site_index' ),
>> ( r'^admin/', include( admin.site.urls ) ),
>> ( r'^foo include( 'stackexchange.foo.urls' ) ),
>> ( r'^bar include( 'stackexchange.bar.urls' ) ),
>> ( r'^static/(?P.*)$', 'django.views.static.serve',
>> {'document_root': settings.MEDIA_ROOT } ),
>>  )
>>
>> You only need the 'static' definition for when you're testing using
>> 'runserver'; Apache intercepts all of the /static/ URLs before Django sees
>> them in production.
>>
>> I hope this helps.
>>
>> - Craig -
>>
>> On Wed, Dec 15, 2010 at 03:17, NoviceSortOf  wrote:
>>
>>> On Dec 15, 8:08 am, mongoose  wrote:
>>> > > I'm trying to run projects on the back of it. For examplehttp://
>>> baseurl.com/mongoose/
>>> > > The projects run but the URL don't work properly because they all
>>> > > reference the 

Re: virtualenv and deployment

2010-12-15 Thread W. Craig Trader
Alex ...

You're not going to be able to trick your host into loading mod_wsgi from an
.htaccess file -- Apache doesn't allow the load directives in .htaccess
files.

While mod_python is not supported, and it has a large number of open issues,
there aren't any specific security holes you really need to worry about; I'm
using mod_python on a project at work because mod_wsgi isn't supported in
our deployment environment.  I wouldn't recommend mod_python as the
direction for all future work, but it will get the job done until you can
get mod_wsgi deployed with your host (or move to another host).

See my earlier post from today (look for Re: running projects on the back of
a base URL and having issues with the homepage) for more details about
making mod_wsgi work with VirtualEnv.  The apache script for mod_python is
similar to the one I posted earlier ; the only differences involve making
certain that you chdir to your project directory, and that you import the
Django mod_python handler.

The mod_python configuration is significantly different from the mod_wsgi
configuration, and look like this:


  SetHandler python-program
  PythonPath "[ '/data/web/foo/apache', ] + sys.path"
  PythonHandler django_mp
  PythonInterpreter foo


  Alias /static/ /data/web/foo/site/foo/static/
  
SetHandler None
  

In this case, mp_python represents /data/web/foo/apache/mp_python.py, which
is my script to deal with configuring the VirtualEnv environment and then
starting the Django mod_python handler.  It's basically an amalgam of the
VirtualEnv activate_this.py script, and the mod_python startup script from
the Django documentation.

- Craig -

On Wed, Dec 15, 2010 at 16:56, Álex González  wrote:

> Hi guys!
>
> Thanks for your replies!
>
> My hosting is a shared hosting and I think that I can only uses mod_python
> at the moment. I can load mod_wsgi from htaccess (I test it) but I can edit
> my virtualhosts or something similar... any trick to get mod_wsgi
> up?
>
> About the virtualenv as Piotr said, some modules must be compiled, so my
> solution was create a requeriments files as he said, but include in my code
> django-registration and django-piston because the versions installed with
> pip doesn't work for me (it said me that it's the correct version, but I can
> get a actual version at bitbucket).
>
> Now my question is, mod_python is deprecated but it's dangerous to use it
> for a months (until I get money to migrate the code to a non-shared
> hosting?). And the old question: can I trick the hosting to use mod_wsgi if
> I can load it from htaccess?
>
> Thanks!
>
>
> On Wed, Dec 15, 2010 at 19:49, Ovnicraft  wrote:
>
>>
>>
>> On Wed, Dec 15, 2010 at 11:48 AM, Álex González wrote:
>>
>>> Hi!
>>>
>>> I'm using virtualenv with --no-site-packages and now I like to do a
>>> deployment of my app... I'm using a sharing hosting, can I uypload all my
>>> enviroment dir (with the packages installed with pip) to the server and use
>>> them?
>>>
>>> What's the better way to the deployment? mod_python, mod_wsgi, perhaps
>>> fast-cgi?
>>>
>>
>>
>> Remember mod_python is deprecated.
>>
>> Regards,
>>
>>
>>> Thanks!
>>>
>>> --
>>> @agonzalezro 
>>> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx,
>>> .ppt and/or .pptx
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@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.
>>>
>>
>>
>>
>> --
>> Cristian Salamea
>> @ovnicraft
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
>
>
> --
> @agonzalezro 
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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 

Confused about thread locals... again.

2010-12-15 Thread Doug Ballance
First, I'd like to find out if there is a better way than thread
locals to do what I want to do.  From what I can tell, it isn't
possible any other way.   Finally, I don't understand why my thread
locals implementation/hack works - which scares me, so I would like to
ask the wiser gurus out there for an explanation.

Need: To alter the template path used by a custom template loader
based on the the request object.  Specifically I want to alter it
based on the incoming domain, and sanitized cookie value allowing
'theme' selection.

I have a basic theme setup using thread locals that works.

in the same module/directory I have:

base.py -> contains the theme objects, thread locals variable, and a
couple of get/set functions that just use getattr/setattr to set a
theme attribute on the local() instance.

middleware.py -> contains the middleware that calls my "set theme"
function

loader.py-> contains the template loader which calls my "get theme"
function

The base setup works fine, but was written with the intention of
subclassing it for another app to set the theme according to a 'site'
object that gets created by another middleware (we serve multiple
sites from one fastcgi instance).  So I have another middleware.py
file in another app that imports my ThemeMiddleware and subclasses it
overriding the method returns the template path to cause the loader to
look for that sites templates.

This does not work.  I get two different thread locals instances
(print shows different addresses), despite all manipulation of the
local variable happening in base.py just as it did in the working
version.

I've had issues in the past with thread locals working differently
depending on module import method.  So I stripped out the thread
locals bit from base.py and put in all by itself in thread_locals.py:

---
try:
from threading import local
except ImportError:
from django.utils._threading_local import local
thread_local=local()


Now in base.py I added 'from thread_locals import thread_local' at the
top of the module, and nothing else changes.  I was hoping that the
same import statment (it's only imported once, in one file) would
bypass the problem, but it doesn't.

Next I moved the thread_locals.py file from the same directory as my
other theme files to the project root, in the same location as
django's settings.py.  No other changes were made.

It works.

I should be happy, but I'm not comfortable allowing solutions I don't
reasonably understand to go into production.  I'd love to drop thread
locals entirely, but short of that some understanding of what is
happening and why would be a big help.  I googled the heck out if it,
but didn't find anything that fit.

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-us...@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: Unclear about my membership status

2010-12-15 Thread Shawn Milochik
It looks like your earlier post made it in:

http://groups.google.com/group/django-users/browse_thread/thread/3157104d4334a643

Also, (obviously), this post of yours showed up. I'd say you're
properly a member.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Unclear about my membership status

2010-12-15 Thread Charlie Shore
I am somewhat unclear about my membership status with the Django users
group.  I subscribed through Google Groups, and posted a message about two
hours ago.  I also received an email record of my post.  However, I don't
see my post listed yet; furthermore, when I go directly to the Django user
group page, it says I can't post because I'm not yet a member.  Can anybody
clarify?

 

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: virtualenv and deployment

2010-12-15 Thread keynesiandreamer
Wow very timely thread!

I am trying to deploy on Dreamhost and struggling.

They have a nice easy to build Django env, but getting my app
running... thats been another matter.

Thanks for asking Alex, and thanks for all the replies to this. Very
informative.

On Dec 15, 1:56 pm, Álex González  wrote:
> Hi guys!
>
> Thanks for your replies!
>
> My hosting is a shared hosting and I think that I can only uses mod_python
> at the moment. I can load mod_wsgi from htaccess (I test it) but I can edit
> my virtualhosts or something similar... any trick to get mod_wsgi
> up?
>
> About the virtualenv as Piotr said, some modules must be compiled, so my
> solution was create a requeriments files as he said, but include in my code
> django-registration and django-piston because the versions installed with
> pip doesn't work for me (it said me that it's the correct version, but I can
> get a actual version at bitbucket).
>
> Now my question is, mod_python is deprecated but it's dangerous to use it
> for a months (until I get money to migrate the code to a non-shared
> hosting?). And the old question: can I trick the hosting to use mod_wsgi if
> I can load it from htaccess?
>
> Thanks!
>
>
>
>
>
> On Wed, Dec 15, 2010 at 19:49, Ovnicraft  wrote:
>
> > On Wed, Dec 15, 2010 at 11:48 AM, Álex González 
> > wrote:
>
> >> Hi!
>
> >> I'm using virtualenv with --no-site-packages and now I like to do a
> >> deployment of my app... I'm using a sharing hosting, can I uypload all my
> >> enviroment dir (with the packages installed with pip) to the server and use
> >> them?
>
> >> What's the better way to the deployment? mod_python, mod_wsgi, perhaps
> >> fast-cgi?
>
> > Remember mod_python is deprecated.
>
> > Regards,
>
> >> Thanks!
>
> >> --
> >> @agonzalezro 
> >> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx,
> >> .ppt and/or .pptx
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Django users" group.
> >> To post to this group, send email to django-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com >>  groups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Cristian Salamea
> > @ovnicraft
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> @agonzalezro 
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: __init__.py file executed twice ?

2010-12-15 Thread mart
Yes it seems usual referring to the blog post. So if the serveur
restart, that's not a problem that the init are executed several times...

With the mod_wsgi and apache where can I see the results of my "print" ?

On 14-12-10 15:41, Brian Bouterse wrote:
> Why do things get started twice in django sometimes?  I see the
> framework being started twice here.  Also if you overload the
> __init__(self): of models, that too gets called twice.  I've never
> understood this, but the singleton pattern seems to provide a nice
> workaround.
>
> Brian
>
> On Mon, Dec 13, 2010 at 5:19 PM, Mike Dewhirst  > wrote:
>
>
> Here is some research by Graham Dumpleton earlier this year and which
> explains the process in detail ...
>
> http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
>
> If you decide to use a singleton to monitor state you might have to
> look for somewhere safe to start it.
>
> >
> > And anyway I just realised another problem : I'll need to have
> access to
> > the objects I created from views.
>
> I think it would work from anywhere you can call the code but you need
> to test it.
>
> Mike
>
> > The idea is to send a message to the thread when a certain action is
> > done (like user registration, validate choices...) but to do
> that I need
> > an access to this object (I cannot create another one because of
> > concurrency safety)
> >
> > Any idea ?
>
> --
> 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.
>
>
>
>
> -- 
> Brian Bouterse
> ITng Services
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: running projects on the back of a base URL and having issues with the homepage

2010-12-15 Thread Graham Dumpleton


On Wednesday, December 15, 2010 11:10:06 PM UTC+11, Craig Trader wrote:
>
> Here's how I solved this problem for my own applications.  Note that I use 
> VirtualEnv to ensure that each application gets exactly the Python 
> environment I want it to have.  If you don't use VirtualEnv, it will make 
> the WSGI startup script simpler.  Assume that my application is installed 
> with the following layout:
>
> /data/web/foo/ -- base directory for foo (and the root of a VirtualEnv 
> environment)
> bin/ -- VirtualEnv scripts, including 'python' symlink
> lib/ -- Python libraries, including Django
> apache/apache.wsgi -- Apache WSGI startup script
> site/foo -- where the Foo site is installed (containing applications 
> like bar, baz, etc.)
> site/foo/static -- where static content is stored
> 
> First, the Apache virtual host configuration:
>
> 
>   ServerName foo.example.com
>   ServerAdmin f...@example.com
>   ServerSignature email
>
>   LogLevel debug
>
>   WSGIProcessGroup  foo
>   WSGIDaemonProcess foo processes=2 threads=5 home=/data/web/foo 
> display-name=foo
>
>   DocumentRoot /var/www
>
>   WSGIScriptAlias / /data/web/foo/apache/django.wsgi
>   
> Order allow,deny
> Allow from all
>   
>
>   Alias /static/ /data/web/foo/site/foo/static/
>   
> SetHandler None
>

Don't need this SetHandler directive. That was need for mod_python but not 
with mod_wsgi.
 

> Order allow,deny
> Allow from all
>   
> 
>
> And now the WSGI startup script (most of this is just to make VirtualEnv 
> work):
>
> import os, sys, site 
>
> here = os.path.abspath( os.curdir )
>

>From here:
 

>
> ALLDIRS = [ 
> os.path.join( here, 'site' ),
> os.path.join( here, 'lib', 'python2.6', 'site-packages' ),
> ]
>
> # Remember original sys.path.
> prev_sys_path = list(sys.path) 
>
> # Add each new site-packages directory.
> for directory in ALLDIRS:
>   site.addsitedir(directory)
>
> # Reorder sys.path so new directories at the front.
> new_sys_path = [] 
> for item in list(sys.path): 
> if item not in prev_sys_path: 
> new_sys_path.append(item) 
> sys.path.remove(item) 
> sys.path[:0] = new_sys_path 
>

to here, should be able to be simplified to:

  activate = os.path.join(here, 'bin', 'activate_this.py')
  execfile(activate, dict(__file__=activate))

  sys.path.insert(0, os.path.join(here, 'site'))

I no longer object to the activate_this.py script even though it modifies 
sys.prefix. Although technically that could be problematic, hasn't shown 
itself to be in practice.

Graham
 

>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'foo.settings'
>
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> In my settings.py file, I have the following:
>
> import os, sys
>
> SITEDIR = os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) ) )
>
> MEDIA_ROOT = os.path.join( SITEDIR, 'foo', 'static' )
> MEDIA_URL = '/static/'
> ADMIN_MEDIA_PREFIX = '/media/'
>
> ROOT_URLCONF = 'foo.urls'
>
> TEMPLATE_DIRS = ( 
> os.path.join( SITEDIR, 'foo', 'templates' ),
> )
>
> INSTALLED_APPS = ( 
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.admin',
> 'foo.bar',
> 'foo.baz',
> )
>
> My urls.py file looks like this:
>
> from django.conf import settings
> from django.conf.urls.defaults import *
> from django.contrib import admin
> from django.shortcuts import render_to_response
>
> # Uncomment the next two lines to enable the admin:
> admin.autodiscover()
>
> def home( *args, **options ):
> return render_to_response( 'index.html' )
>
> urlpatterns = patterns( '',
> url( r'^$', home, name='site_index' ),
> ( r'^admin/', include( admin.site.urls ) ),
> ( r'^foo include( 'stackexchange.foo.urls' ) ),
> ( r'^bar include( 'stackexchange.bar.urls' ) ),
> ( r'^static/(?P.*)$', 'django.views.static.serve',
> {'document_root': settings.MEDIA_ROOT } ),
>  )
>
> You only need the 'static' definition for when you're testing using 
> 'runserver'; Apache intercepts all of the /static/ URLs before Django sees 
> them in production.
>
> I hope this helps.
>
> - Craig -
>
> On Wed, Dec 15, 2010 at 03:17, NoviceSortOf  wrote:
>
>> On Dec 15, 8:08 am, mongoose  wrote:
>> > > I'm trying to run projects on the back of it. For examplehttp://
>> baseurl.com/mongoose/
>> > > The projects run but the URL don't work properly because they all
>> > > reference the base url. So for 'About Me' page it points tohttp://
>> baseurl.com/aboutinsteadofhttp://baseurl.com/mongoose/about
>> >
>> > > Is this something i need to change in django or apache? Is what I'm
>> > > trying to do even possible?
>>
>> I wrestled with something like this - as we needed a static homepage
>> based on a django backend for one site.
>>
>> Per my recollection 

Re: virtualenv and deployment

2010-12-15 Thread Álex González
Hi guys!

Thanks for your replies!

My hosting is a shared hosting and I think that I can only uses mod_python
at the moment. I can load mod_wsgi from htaccess (I test it) but I can edit
my virtualhosts or something similar... any trick to get mod_wsgi
up?

About the virtualenv as Piotr said, some modules must be compiled, so my
solution was create a requeriments files as he said, but include in my code
django-registration and django-piston because the versions installed with
pip doesn't work for me (it said me that it's the correct version, but I can
get a actual version at bitbucket).

Now my question is, mod_python is deprecated but it's dangerous to use it
for a months (until I get money to migrate the code to a non-shared
hosting?). And the old question: can I trick the hosting to use mod_wsgi if
I can load it from htaccess?

Thanks!

On Wed, Dec 15, 2010 at 19:49, Ovnicraft  wrote:

>
>
> On Wed, Dec 15, 2010 at 11:48 AM, Álex González wrote:
>
>> Hi!
>>
>> I'm using virtualenv with --no-site-packages and now I like to do a
>> deployment of my app... I'm using a sharing hosting, can I uypload all my
>> enviroment dir (with the packages installed with pip) to the server and use
>> them?
>>
>> What's the better way to the deployment? mod_python, mod_wsgi, perhaps
>> fast-cgi?
>>
>
>
> Remember mod_python is deprecated.
>
> Regards,
>
>
>> Thanks!
>>
>> --
>> @agonzalezro 
>> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx,
>> .ppt and/or .pptx
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
>
>
> --
> Cristian Salamea
> @ovnicraft
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



-- 
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

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



Developing a search engine

2010-12-15 Thread marcoarreguin
I'm trying to make a search engine with my database, parsing de text
that the user write in the textbox to make a list with the cleaned
words, in just one table of the DB in the fields: title, descripcion
and tags, I have something like this but I don't know how to finish
it:


from django.http import HttpResponse
from django.shortcuts import render_to_response
from myproject.parsing.models import Stores
from pyparsing import *
from django.db.models import Q

def search_form(request):
return render_to_response('search_form.html')

def search(request):
errors= []
if 'q' in request.GET:
q = request.GET['q']
if not q:
errors.append('Write something')
else:
qclean= parseText(q)
for Word in qclean:
Foundstores = 
Stores.objects.filter(Q(name__icontains=Word) |
Q(description__icontains=Word) | Q(tags__icontains=Word))

#But remeber that I have more than one word,
so I need to concatenate all the querysets of each one of the words in
qclean

return render_to_response('search_results.html', {'Found':
Foundstores, 'query': qclean})

return render_to_response('search_form.html', {'errors': errors})



def parseText(texto):
parser=OneOrMore(Word(alphas))
#articles in spanish
arreglo=("de","en","la")
for articulo in arreglo:
parser.ignore(CaselessLiteral(articulo))
salida=parser.parseString(texto)
return salida

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



Developing a search engine

2010-12-15 Thread marcoarreguin
I'm trying to make a search engine with my database, parsing de text
that the user write in the textbox to make a list with the cleaned
words, in just one table of the DB in the fields: title, descripcion
and tags, I have something like this but I don't know how to finish
it:


from django.http import HttpResponse
from django.shortcuts import render_to_response
from myproject.parsing.models import Stores
from pyparsing import *
from django.db.models import Q

def search_form(request):
return render_to_response('search_form.html')

def search(request):
errors= []
if 'q' in request.GET:
q = request.GET['q']
if not q:
errors.append('Write something')
else:
qclean= parseText(q)
for Word in qclean:
Foundstores = 
Stores.objects.filter(Q(name__icontains=Word) |
Q(description__icontains=Word) | Q(tags__icontains=Word))

#But remeber that I have more than one word,
so I need to concatenate all the querysets of each one of the words in
qclean

return render_to_response('search_results.html', {'Found':
Foundstores, 'query': qclean})

return render_to_response('search_form.html', {'errors': errors})



def parseText(texto):
parser=OneOrMore(Word(alphas))
#articles in spanish
arreglo=("de","en","la")
for articulo in arreglo:
parser.ignore(CaselessLiteral(articulo))
salida=parser.parseString(texto)
return salida

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Logging Handler AdminEmailHandler not working

2010-12-15 Thread Adrián Ribao
I get an error when using AdminEmailHandler.

The error message is: __init__() takes at least 5 non-keyword
arguments (2 given)

is in django/django/utils/log.py in emit line 90:

reporter = ExceptionReporter(request, is_email=True, *exc_info)

where exc_info = ()

Is it a bug or I'm missing something?

Thank you,

Adrian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Mailing list service written in Django?

2010-12-15 Thread CLIFFORD ILKAY

On 12/14/2010 04:07 PM, Steven Clift wrote:

Is there one?

We use the Zope-based GPL http://GroupServer.org platform with good
success, but we are interested in ways to connect it to possible
future Django run sites.


Colibri  might be useful 
as an eventual replacement for GroupServer, though it's certainly not as 
feature-complete as GroupServer.

--
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.



Getting 'specified module cannot be found' error when synching model to DB

2010-12-15 Thread Charlie
I've set up a PostgreSQL/PostGIS spatial database, and created
settings and model files for a new project.  When I try to synch the
model with the DB, I get the following error message (last lines
only):

  File "c:\Python26\lib\ctypes\__init__.py", line 355, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

I ran a print statement in the __init__py file and found that the
module they're referring to is kernel32.  Can anyone provide any
insight into this?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: virtualenv and deployment

2010-12-15 Thread Ovnicraft
On Wed, Dec 15, 2010 at 11:48 AM, Álex González wrote:

> Hi!
>
> I'm using virtualenv with --no-site-packages and now I like to do a
> deployment of my app... I'm using a sharing hosting, can I uypload all my
> enviroment dir (with the packages installed with pip) to the server and use
> them?
>
> What's the better way to the deployment? mod_python, mod_wsgi, perhaps
> fast-cgi?
>


Remember mod_python is deprecated.

Regards,


> Thanks!
>
> --
> @agonzalezro 
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



-- 
Cristian Salamea
@ovnicraft

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: virtualenv and deployment

2010-12-15 Thread W. Craig Trader
Alex ...

In order to do a simple copy you'll need to make sure that:

   1. You're using the exact same version of Python on the host as you use
   to develop.
   2. Python is installed in exactly the same locations (host and local).
   3. Your environment is located in the same locations (host and local).

If not, you're going to need to experiment with virtualenv --relocatable to
see if it meets your needs.  (I'm doing this for my application, but it
isn't perfect, and doesn't work well with Windows.)

Failing that, you may need to create a new virtual environment on the host,
and then install your packages using pip, before copying your application
files.  (pip freeze and pip bundle can be your friends here.)

- Craig -

On Wed, Dec 15, 2010 at 11:48, Álex González  wrote:

> Hi!
>
> I'm using virtualenv with --no-site-packages and now I like to do a
> deployment of my app... I'm using a sharing hosting, can I uypload all my
> enviroment dir (with the packages installed with pip) to the server and use
> them?
>
> What's the better way to the deployment? mod_python, mod_wsgi, perhaps
> fast-cgi?
>
> Thanks!
>
> --
> @agonzalezro 
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



A browser of tags (very difficult... unless for me)

2010-12-15 Thread marcoarreguin
Hi, I have a big problem, I'm doing a browser, but I'm using a lot of
things kind itertools and pyparsing and combinations like nCm to
combine tags and make a lot of search.

I think the problem is about combining querysets to show one result.

I'll show you the algorithm, this is my view, and as you can see is so
difficult :s

from django.http import HttpResponse
from django.shortcuts import render_to_response
from myproject.parsing.models import Gente
from pyparsing import *
import itertools
from django.db.models import Q


def search(request):
errors= []
if 'q' in request.GET:
q = request.GET['q']
if not q:
errors.append('Escribe algo en la caja de texto')
else:
qlimpia=parseText(q)
for i in range(len(qlimpia),0,-1):
for lista in itertools.combinations(qlimpia,i):
filtro = Q()
for t in lista:
filtro = filtro & Q(tags__icontains=t)

#I think here is my problem, I can't concatenate the
query set in this way
negocios = negocios | Gente.objects.filter(filtro)
return render_to_response('search_results.html',
{'negocios': negocios, 'query': qlimpia})
return render_to_response('search_form.html', {'errors': errors})



def parseText(texto):
parser=OneOrMore(Word(alphas))
arreglo=("de","en","la")
for articulo in arreglo:
parser.ignore(CaselessLiteral(articulo))
salida=parser.parseString(texto)
for i in range(0,len(salida)):
salida[i] = " "+salida[i]+" "
return salida


def search_form(request):
return render_to_response('search_form.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-us...@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: Controlling File Downloads.

2010-12-15 Thread Matteius
Please check the classcomm project for how to do this. We determined
the best/fastest approach would be to use Apache mod_auth_token and
generate secure URLs using a custom template tag.  You can find code
and instructions for how to do that @ http://classcomm.googlecode.com/
and across the Internet.  This is the best approach because the files
are severed off the web server pretty much like any static overheard
file.  Then in your view code you check a User's permission to the
file before generating them the time-sensitive URL.

Cheers!
Matteius

On Dec 15, 5:16 am, "euan.godd...@googlemail.com"
 wrote:
> If you're using apache you might want to consider wiring your app to
> generate mod_auth_token URLs and have apache receive these.
>
> On Dec 15, 8:29 am, NoviceSortOf  wrote:
>
>
>
> > What is the best way to allow authorized downloads
> > to specific users in Django.
>
> > We have 2 possible scenarios that could work for us.
>
> > 1. A download directory where any user can download any
> >    file in the folder.
>
> > or
>
> > 2. Granting specific rights to specific users to download a specific
> > file
> > or set of files.
>
> > Any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Why might a Django admin form hang (or, how can I diagnose the problem)?

2010-12-15 Thread Michael Dippery
I have a model tied to the admin. Whenever I try to add a new model instance, 
or update an existing one, the form hangs while trying to submit. Nothing is 
written to the log files, though. The models are nothing fancy, so they don't 
have any custom validation that may be causing, e.g., and infinite loop. Also, 
the hang only occurs on my production server, not on the staging server or my 
local development machine.

Any ideas as to what might be causing the hang? Or, since that's probably hard 
to answer without all the specifics of my setup and application, what's the 
best way to diagnose the problem?




Michael Dippery
mdipp...@gmail.com | www.monkey-robot.com



smime.p7s
Description: S/MIME cryptographic signature


Re: virtualenv and deployment

2010-12-15 Thread Piotr Kilczuk
Hi,


> I'm using virtualenv with --no-site-packages and now I like to do a
> deployment of my app... I'm using a sharing hosting, can I uypload all my
> enviroment dir (with the packages installed with pip) to the server and use
> them?
>

That won't necessarily work. Some packages need to be compiled, so it would
only work if both environments are the same architecture.


> What's the better way to the deployment? mod_python, mod_wsgi, perhaps
> fast-cgi?
>

mod_python is too old, I'm running fine with both nginx+mod_fcgi as well as
Apache+mod_wsgi.

As my namesake mentioned, I'd freeze your env and rebuild it using pip
install. Of course you have access to the cline on the server? :)

Regards,
Piotr

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: virtualenv and deployment

2010-12-15 Thread Piotr Zalewa
Better would be to create the requirements.txt and install directly on 
the server (pip install ir requirements.txt)

I use mod_wsgi

On 10-12-15 08:48, Álex González wrote:

Hi!

I'm using virtualenv with --no-site-packages and now I like to do a 
deployment of my app... I'm using a sharing hosting, can I uypload all 
my enviroment dir (with the packages installed with pip) to the server 
and use them?


What's the better way to the deployment? mod_python, mod_wsgi, perhaps 
fast-cgi?


Thanks!

--
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, 
.ppt and/or .pptx

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

To post to this group, send email to django-us...@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.



--
blog http://piotr.zalewa.info
jobs http://webdev.zalewa.info
twit http://twitter.com/zalun
face http://www.facebook.com/zaloon

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: incrementing non primary keys.

2010-12-15 Thread Eric Chamberlain
If you are using a UUID for the primary key, do you really need an integer?

We had a similar multi-tenant need and didn't want to leak usage information to 
the users, so we used UUID instead of auto incrementing integers.


On Dec 15, 2010, at 9:23 AM, Hutch wrote:

> Hi,
> 
> I'm porting an old php app and have run into a bit of an issue. The
> main problem is that we this app will need to be used by multiple
> different companies. While I could just setup discreet instances, I'm
> thinking that making the app multi-tenant would be a much wiser idea
> and easier on resources, as traffic will be reasonably low, maybe
> 100-200 users a day. I also don't desire to deal with 4 installations
> of the code, when one will do.
> 
> The specific problem I have though, is in the legacy app, the primary
> key for a certain table is an auto incrementing integer. This needs be
> kept separate for each tenant. What I'm planning on doing is making
> the primary key a uuid, and using unique_together with an integer
> field. However I could easily see a race condition with incrementing
> the integer field. What is the best way to handle this situation?
> 
> Also, what is the best way of filtering based on the site_id? should i
> store a setting with the session and filter based on that? I was
> thinking about seeing if it's possible to use a middleware to change
> it at run time based on the request url. Is that a good idea?
> 
> are there any documents on best practices for django multitenancy?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



virtualenv and deployment

2010-12-15 Thread Álex González
Hi!

I'm using virtualenv with --no-site-packages and now I like to do a
deployment of my app... I'm using a sharing hosting, can I uypload all my
enviroment dir (with the packages installed with pip) to the server and use
them?

What's the better way to the deployment? mod_python, mod_wsgi, perhaps
fast-cgi?

Thanks!

-- 
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django Forms and Javascript/Jquery Experienced Developer Wanted - Modal Dialog Contract Work

2010-12-15 Thread sstartup
Hello Django Developer Community,

We are a New York-based start-up looking for a developer experienced
with Django Forms and Javascript/Jquery for some multi-step modal
dialog contract work.  If you have experience in this area, and are
interested, please do send us an email at efr...@gmail.com.

Best,
Evan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django-Facebook (yet another thread)

2010-12-15 Thread da.inter...@gmx.net
I had the same problems last weekend. This one here helped me a lot
and is actually working:

https://github.com/iplatform/pyFaceGraph

The tricky thing is how to get the access_token (Aljosa mentioned the
proper documentation). The graphdevtools-example-application under
"test" is also helpful here to get the token inside your application.

On 14 Dez., 20:37, Orazio  wrote:
> Hi all,
> Last day I got the bright idea to start building a facebook app in
> django. I was convinced that documentation would be good given that
> django docs are very well written and facebook is a big project.
> Insteadaaarrg
> On facebook side, there are old and messy docs full of stale options
> and broken links (they changed something in their developer part of
> site...)!
> On django side, lot of small and sometimes unfinished project with no
> docs, and not compatible with recent version of django or fb api. Just
> to cite few:
>
> http://github.com/facebook/python-sdkhttps://github.com/ryanmark/django-facebookconnect/tree/master/facebo...https://github.com/sciyoshi/pyfacebook/https://github.com/tschellenbach/Django-facebookhttps://github.com/dickeytk/django_facebook_oauthhttp://github.com/flashingpumpkin/django-socialregistration
>
> So my question is: which is the best way to realize TODAY a (not so)
> simple hello world application that does some basic tasks such
> - ask to fb user the right to publish things on wall and obtain
> personal data like all the other fb app
> - show my fb name
> - publish something "hello world" on wall
> - be able to comunicate with my server using post (like the example
> for fbconnect should do)
>
> Preventing questions, nowadays:
> - pyfacebook seems not to be compatible to django 1.2.x and their
> example don't work (at least for me)
> - facebook apps are moving to Iframe so that FBML apps will be no
> longer accepted from the next year (according to fb roadmap)
> - python-sdk, to the best of my knowledge, are the only one supported
> by facebook staff. This would be good because I would not like that my
> app relies on a stale-in-6-month library. Unfortunately, I didn't
> understand how to use it in django to do those tasks.
>
> So, today which is the better choice to write an app that do those
> basic tasks? And where can I find some updated documentation ?
>
> Thanks for any clarification! :)
>
> Lorenzo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



incrementing non primary keys.

2010-12-15 Thread Hutch
Hi,

I'm porting an old php app and have run into a bit of an issue. The
main problem is that we this app will need to be used by multiple
different companies. While I could just setup discreet instances, I'm
thinking that making the app multi-tenant would be a much wiser idea
and easier on resources, as traffic will be reasonably low, maybe
100-200 users a day. I also don't desire to deal with 4 installations
of the code, when one will do.

The specific problem I have though, is in the legacy app, the primary
key for a certain table is an auto incrementing integer. This needs be
kept separate for each tenant. What I'm planning on doing is making
the primary key a uuid, and using unique_together with an integer
field. However I could easily see a race condition with incrementing
the integer field. What is the best way to handle this situation?

Also, what is the best way of filtering based on the site_id? should i
store a setting with the session and filter based on that? I was
thinking about seeing if it's possible to use a middleware to change
it at run time based on the request url. Is that a good idea?

are there any documents on best practices for django multitenancy?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Beginner Problem: I don`t get my view working

2010-12-15 Thread bruno desthuilliers
On 15 déc, 16:05, josch  wrote:
> Hallo,
>
> I don`t know what is wrong with my code, but I can not call a view in
> the urls.py of my site:
>
> I have an application hspoints. In the folder is a views.py. In will
> post a view files:
>
> urls.py of my Site:
>
> from django.conf.urls.defaults import *
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     (r'^hspoints/$', include(hspoints.views.index)),

include() is meant to include an app's urls.py module, not to map a
pattern to a view.

>     (r'^admin/', include(admin.site.urls)),
> )
>
> When i start the testserver withhttp://127.0.0.1:8000/hspoints/I
> get:
>
> NameError at /hspoints/
>
> name 'hspoints' is not defined

Indeed.

> When I add import hspoints to the urls.py of my site, what I did not
> have to do in the poll tutorial

Re-read the tutorial more carefully... and then the FineManual's
section about views and urls ;)


The common idiom is to have app-specific urls defined in the app's
urls.py module, then include this urls.py module from the project's
root urls.py, ie:

# hspoints/urls.py

from django.conf.urls.defaults import *
import views

urlpatterns = patterns('',
 (r'^/$', views.index),
 # your other app-specific url patterns here
   )


# urls.py

urlpatterns = patterns('',
 (r'^hspoints/$', include("hspoints.urls")),
 (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-us...@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: incrementing non primary keys.

2010-12-15 Thread Eric Chamberlain
If you are using a UUID for the primary key, do you really need an integer?

We had a similar multi-tenant need and didn't want to leak usage information to 
the users, so we used UUID instead of auto incrementing integers.


On Dec 15, 2010, at 9:23 AM, Hutch wrote:

> Hi,
> 
> I'm porting an old php app and have run into a bit of an issue. The
> main problem is that we this app will need to be used by multiple
> different companies. While I could just setup discreet instances, I'm
> thinking that making the app multi-tenant would be a much wiser idea
> and easier on resources, as traffic will be reasonably low, maybe
> 100-200 users a day. I also don't desire to deal with 4 installations
> of the code, when one will do.
> 
> The specific problem I have though, is in the legacy app, the primary
> key for a certain table is an auto incrementing integer. This needs be
> kept separate for each tenant. What I'm planning on doing is making
> the primary key a uuid, and using unique_together with an integer
> field. However I could easily see a race condition with incrementing
> the integer field. What is the best way to handle this situation?
> 
> Also, what is the best way of filtering based on the site_id? should i
> store a setting with the session and filter based on that? I was
> thinking about seeing if it's possible to use a middleware to change
> it at run time based on the request url. Is that a good idea?
> 
> are there any documents on best practices for django multitenancy?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: incrementing non primary keys.

2010-12-15 Thread Eric Chamberlain
If you are using a UUID for the primary key, do you really need an integer?

We had a similar multi-tenant need and didn't want to leak usage information to 
the users, so we used UUID instead of auto incrementing integers.


On Dec 15, 2010, at 9:23 AM, Hutch wrote:

> Hi,
> 
> I'm porting an old php app and have run into a bit of an issue. The
> main problem is that we this app will need to be used by multiple
> different companies. While I could just setup discreet instances, I'm
> thinking that making the app multi-tenant would be a much wiser idea
> and easier on resources, as traffic will be reasonably low, maybe
> 100-200 users a day. I also don't desire to deal with 4 installations
> of the code, when one will do.
> 
> The specific problem I have though, is in the legacy app, the primary
> key for a certain table is an auto incrementing integer. This needs be
> kept separate for each tenant. What I'm planning on doing is making
> the primary key a uuid, and using unique_together with an integer
> field. However I could easily see a race condition with incrementing
> the integer field. What is the best way to handle this situation?
> 
> Also, what is the best way of filtering based on the site_id? should i
> store a setting with the session and filter based on that? I was
> thinking about seeing if it's possible to use a middleware to change
> it at run time based on the request url. Is that a good idea?
> 
> are there any documents on best practices for django multitenancy?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: No module named _md5

2010-12-15 Thread Cal Leeming [Simplicity Media Ltd]
http://www.google.co.uk/search?sourceid=chrome=UTF-8=%22No+module+named+_md5%22

That should help you figure out why it's not working :)

Try and figure it out first, and if you can't figure it out then you might
want to consider not using Python on Linux, because you will encounter many
problems like this throughout your time with python :)


On Wed, Dec 15, 2010 at 4:41 AM, NavaTux  wrote:

> Same problem occurs;
>
>
> " (blogg)hire...@hirelex-laptop:~/Desktop/blogg/src$ *find -iname '*.pyc'
> -exec rm -f '{}' \;*
> (blogg)hire...@hirelex-laptop:~/Desktop/blogg/src$ cd ..
> (blogg)hire...@hirelex-laptop:~/Desktop/blogg$ ls
> bin  blogsrc  include  lib  src
> (blogg)hire...@hirelex-laptop:~/Desktop/blogg$ cd blogsrc/
> (blogg)hire...@hirelex-laptop:~/Desktop/blogg/blogsrc$ ls
> blog __init__.pyc  settings.py   settings.pyc  urls.py   urls.pyc
> __init__.py  manage.py settings.py~  templates urls.py~
> (blogg)hire...@hirelex-laptop:~/Desktop/blogg/blogsrc$ *python manage.py
> runserver*
> Traceback (most recent call last):
>   File "manage.py", line 11, in 
> execute_manager(settings)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
> line 438, in execute_manager
> utility.execute()
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
> line 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
> line 191, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
> line 209, in execute
> translation.activate('en-us')
>   File
> "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py",
> line 66, in activate
> return real_activate(language)
>   File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py",
> line 55, in _curried
> return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
>   File
> "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py",
> line 36, in delayed_loader
> return getattr(trans, real_name)(*args, **kwargs)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py",
> line 193, in activate
> _active[currentThread()] = translation(language)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py",
> line 176, in translation
> default_translation = _fetch(settings.LANGUAGE_CODE)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py",
> line 159, in _fetch
> app = import_module(appname)
>   File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
> line 35, in import_module
> __import__(name)
>   File
> "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/__init__.py",
> line 1, in 
> from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
>   File
> "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/helpers.py",
> line 1, in 
> from django import forms
>   File "/usr/local/lib/python2.6/dist-packages/django/forms/__init__.py",
> line 17, in 
> from models import *
>   File "/usr/local/lib/python2.6/dist-packages/django/forms/models.py",
> line 6, in 
> from django.db import connections
>   File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py", line
> 77, in 
> connection = connections[DEFAULT_DB_ALIAS]
>   File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py", line
> 91, in __getitem__
> backend = load_backend(db['ENGINE'])
>   File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py", line
> 49, in load_backend
> raise ImproperlyConfigured(error_msg)
> django.core.exceptions.ImproperlyConfigured:
> 'django.db.backends.postgresql_psycopg2' isn't an available database
> backend.
> Try using django.db.backends.XXX, where XXX is one of:
> 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2',
> 'sqlite3'
> Error was: *No module named _md5*
> (blogg)hire...@hirelex-laptop:~/Desktop/blogg/blogsrc$
> "
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Order a QuerySet by Method

2010-12-15 Thread josch
Thank you!

On 15 Dez., 15:21, Daniel Roseman  wrote:
> On Wednesday, December 15, 2010 1:34:15 PM UTC, josch wrote:
>
> > Hallo,
>
> > I know, that the normal way to do that is to write the return value of
> > the method to the foreign model, always when a model that affects the
> > return value changes, and than order by that value of the model.
>
> > But I have a model whoose objects gets a specific state after they are
> > older than a specific number of days. And i don`t want to use a
> > cronjob or something like that to update the foreign model`s value.
>
> > So, can someone tell me, how I can order a query set by one of the
> > function of it`s models, in a pinch by reordering the obecjts in a new
> > object array or some kind like that.
>
> > There are not a lot of records I have to order, so I think there is no
> > performance problem for my kind of application.
>
> > Thank you!
>
> You can convert the queryset to a list, then call the standard list sort
> method on it, passing the method as the key:
>
>     results = MyModel.objects.filter(criteria=whatever)
>     results = list(results)
>     results.sort(key=lambda x: x.my_method())
>
> Obviously, as you note, this is not as efficient as doing the sorting in the
> database, but for small numbers of objects it should be acceptable.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Beginner Problem: I don`t get my view working

2010-12-15 Thread josch
Hallo,

I don`t know what is wrong with my code, but I can not call a view in
the urls.py of my site:

I have an application hspoints. In the folder is a views.py. In will
post a view files:


settings.py of my Site:

(...)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'hspoints'
)
(...)


view.py of my application hspoints:

from django.http import HttpResponse

def index(request):
return HttpResponse("Hello, world. You're at the index.")


urls.py of my Site:

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^hspoints/$', include(hspoints.views.index)),
(r'^admin/', include(admin.site.urls)),
)


When i start the testserver with http://127.0.0.1:8000/hspoints/ I
get:

NameError at /hspoints/

name 'hspoints' is not defined


When I add import hspoints to the urls.py of my site, what I did not
have to do in the poll tutorial, I get:

AttributeError at /hspoints/

'module' object has no attribute 'views'



What am I do wrong? I just don`t get what I forgot to do...

Info: I`m working with PyDev in Eclipse.

Thank you!




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Order a QuerySet by Method

2010-12-15 Thread Daniel Roseman
On Wednesday, December 15, 2010 1:34:15 PM UTC, josch wrote:
>
> Hallo, 
>
> I know, that the normal way to do that is to write the return value of 
> the method to the foreign model, always when a model that affects the 
> return value changes, and than order by that value of the model. 
>
> But I have a model whoose objects gets a specific state after they are 
> older than a specific number of days. And i don`t want to use a 
> cronjob or something like that to update the foreign model`s value. 
>
> So, can someone tell me, how I can order a query set by one of the 
> function of it`s models, in a pinch by reordering the obecjts in a new 
> object array or some kind like that. 
>
> There are not a lot of records I have to order, so I think there is no 
> performance problem for my kind of application. 
>
> Thank you!


You can convert the queryset to a list, then call the standard list sort 
method on it, passing the method as the key:

results = MyModel.objects.filter(criteria=whatever)
results = list(results)
results.sort(key=lambda x: x.my_method())

Obviously, as you note, this is not as efficient as doing the sorting in the 
database, but for small numbers of objects it should be acceptable.
--
DR.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Order a QuerySet by Method

2010-12-15 Thread josch
Hallo,

I know, that the normal way to do that is to write the return value of
the method to the foreign model, always when a model that affects the
return value changes, and than order by that value of the model.

But I have a model whoose objects gets a specific state after they are
older than a specific number of days. And i don`t want to use a
cronjob or something like that to update the foreign model`s value.

So, can someone tell me, how I can order a query set by one of the
function of it`s models, in a pinch by reordering the obecjts in a new
object array or some kind like that.

There are not a lot of records I have to order, so I think there is no
performance problem for my kind of application.

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Mailing list service written in Django?

2010-12-15 Thread Steven Clift
Thanks, we are quite bullish with GroupServer - much better web
interface than Mailman and while people like the utility of Google
Groups, GroupServer is customizable and you can control your group
data.

That said, since Django has come up in our new Neighborly work, the
more we know about existing code the better. (We are big believers in
tools that support email publishing in an integrated fashion.) The
quirky thing about Neighborly is the idea that each participant in the
center of their own online network of nearest neighbors so the past
group as declared space paradigm doesn't really apply.


On Tuesday, December 14, 2010, Dan Fairs  wrote:
>> We use the Zope-based GPL http://GroupServer.org platform with good
>> success, but we are interested in ways to connect it to possible
>> future Django run sites.
>
> Don't throw the baby out with the bathwater (unless you really don't like the 
> baby). It's pretty straightforward to connect Zope to a relational database - 
> either with the built-in ZSQLMethods, or with SQLAlchemy.
>
> Cheers,
> Dan
> --
> Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



Strange Admin CSS Behaviour

2010-12-15 Thread Paul Childs
I'm trying to use the Django admin (on the dev server that comes with
Django) for the latest stable version 1.2.3 on windows with Python
2.6. Functionally it works great.
For some reason the styles do not render for the site admin page and
my application admin page.
The respective URLS are: http://127.0.0.1:8000/admin/ and
http://127.0.0.1:8000/admin/asi/ where "asi" is my application.
All the other admin pages displaying properly: login, change pages,
list pages, change password, etc.
The only difference I see when I look at the source is that the pages
in question use dashboard.css instead of base.css.
I have tried moving the admin media directory to my project media
folder and serve it up myself but that did not seem to fix the
problem.
I uninstalled Django and reinstalled using a fresh download of 1.2.3.
I haven't come across anyone else having this problem either.
If anyone has an idea how to fix this or can point me in the right
direction to troubleshoot this, I would appreciate it.
/Paul

 Here are the media settings in my settings.py

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com;, "http://example.com/media/;
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure
to use a
# trailing slash.
# Examples: "http://foo.com/media/;, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django comments moderation stopped working

2010-12-15 Thread Groady
Just wondering if anyone else is having problems with the Django
Comments Framework, specifically with the moderation functionality
stopping working.

Recently the moderation functionality has stopped working and all
comments are getting through without first being approved. I'm not
100% sure what it is that has caused this as it WAS working and now it
isn't. I have upgraded the Django installation to the latest version
recently so I have a feeling this may be the problem (though it
shouldn't be).

I have checked and double checked my code matches the moderation
documentation here: 
http://docs.djangoproject.com/en/1.2/ref/contrib/comments/moderation/.
It feels as if the moderator is being skipped over entirely as the
is_public field is set to True by default where is should be set to
False by my custom CommentModerator. Also my custom CommentModerator
has akismet code which normally deletes spam messages automatically
but this doesn't seem to be working (hence me thinking the moderator
is not being invoked at all).

Just wondering if anyone is having the same problem and if there are
any suggestion on how I might be able to debug this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django-Facebook (yet another thread)

2010-12-15 Thread Martey
In my Facebook applications, I have used a combination of the official
Python SDK  and the official
JavaScript SDK . The JavaScript SDK takes care of authentication,
requesting permissions, and providing an access token, which I then
pass to the Python SDK in order to access information through the API.

There is, as far as I know, no official documentation involving Django
and the Python SDK, but one of the comments on a bug report asking for
a Django example suggested . I have not run that code, but
a cursory reading suggests that it would be helpful.

On Dec 14, 2:37 pm, Orazio  wrote:
> Hi all,
> Last day I got the bright idea to start building a facebook app in
> django. I was convinced that documentation would be good given that
> django docs are very well written and facebook is a big project.
> Insteadaaarrg
> On facebook side, there are old and messy docs full of stale options
> and broken links (they changed something in their developer part of
> site...)!
> On django side, lot of small and sometimes unfinished project with no
> docs, and not compatible with recent version of django or fb api. Just
> to cite few:
>
> http://github.com/facebook/python-sdkhttps://github.com/ryanmark/django-facebookconnect/tree/master/facebo...https://github.com/sciyoshi/pyfacebook/https://github.com/tschellenbach/Django-facebookhttps://github.com/dickeytk/django_facebook_oauthhttp://github.com/flashingpumpkin/django-socialregistration
>
> So my question is: which is the best way to realize TODAY a (not so)
> simple hello world application that does some basic tasks such
> - ask to fb user the right to publish things on wall and obtain
> personal data like all the other fb app
> - show my fb name
> - publish something "hello world" on wall
> - be able to comunicate with my server using post (like the example
> for fbconnect should do)
>
> Preventing questions, nowadays:
> - pyfacebook seems not to be compatible to django 1.2.x and their
> example don't work (at least for me)
> - facebook apps are moving to Iframe so that FBML apps will be no
> longer accepted from the next year (according to fb roadmap)
> - python-sdk, to the best of my knowledge, are the only one supported
> by facebook staff. This would be good because I would not like that my
> app relies on a stale-in-6-month library. Unfortunately, I didn't
> understand how to use it in django to do those tasks.
>
> So, today which is the better choice to write an app that do those
> basic tasks? And where can I find some updated documentation ?
>
> Thanks for any clarification! :)
>
> Lorenzo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



template filter by foreignkey

2010-12-15 Thread refreegrata
Hello list. I have a question. Whit a model like this
--
class Ghi(models.model):
   dat = models.IntegerField(unique =True)

class Def(models.Model):
ghis = models.ForeignKeyField(Ghi)

class Abc(models.Model):
defs = models.ManyToManyField(Def)
--
And from my view I return something like
Abc.objects.all()

Are some way to ask in the template something like:
exists in Abc.defs.ghis.dat == 1?

thanks for read.
P.D.: Django 1.2.1

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: running projects on the back of a base URL and having issues with the homepage

2010-12-15 Thread W. Craig Trader
Here's how I solved this problem for my own applications.  Note that I use
VirtualEnv to ensure that each application gets exactly the Python
environment I want it to have.  If you don't use VirtualEnv, it will make
the WSGI startup script simpler.  Assume that my application is installed
with the following layout:

/data/web/foo/ -- base directory for foo (and the root of a VirtualEnv
environment)
bin/ -- VirtualEnv scripts, including 'python' symlink
lib/ -- Python libraries, including Django
apache/apache.wsgi -- Apache WSGI startup script
site/foo -- where the Foo site is installed (containing applications
like bar, baz, etc.)
site/foo/static -- where static content is stored

First, the Apache virtual host configuration:


  ServerName foo.example.com
  ServerAdmin f...@example.com
  ServerSignature email

  LogLevel debug

  WSGIProcessGroup  foo
  WSGIDaemonProcess foo processes=2 threads=5 home=/data/web/foo
display-name=foo

  DocumentRoot /var/www

  WSGIScriptAlias / /data/web/foo/apache/django.wsgi
  
Order allow,deny
Allow from all
  

  Alias /static/ /data/web/foo/site/foo/static/
  
SetHandler None
Order allow,deny
Allow from all
  


And now the WSGI startup script (most of this is just to make VirtualEnv
work):

import os, sys, site

here = os.path.abspath( os.curdir )

ALLDIRS = [
os.path.join( here, 'site' ),
os.path.join( here, 'lib', 'python2.6', 'site-packages' ),
]

# Remember original sys.path.
prev_sys_path = list(sys.path)

# Add each new site-packages directory.
for directory in ALLDIRS:
  site.addsitedir(directory)

# Reorder sys.path so new directories at the front.
new_sys_path = []
for item in list(sys.path):
if item not in prev_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[:0] = new_sys_path

os.environ['DJANGO_SETTINGS_MODULE'] = 'foo.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

In my settings.py file, I have the following:

import os, sys

SITEDIR = os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) ) )

MEDIA_ROOT = os.path.join( SITEDIR, 'foo', 'static' )
MEDIA_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/media/'

ROOT_URLCONF = 'foo.urls'

TEMPLATE_DIRS = (
os.path.join( SITEDIR, 'foo', 'templates' ),
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'foo.bar',
'foo.baz',
)

My urls.py file looks like this:

from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib import admin
from django.shortcuts import render_to_response

# Uncomment the next two lines to enable the admin:
admin.autodiscover()

def home( *args, **options ):
return render_to_response( 'index.html' )

urlpatterns = patterns( '',
url( r'^$', home, name='site_index' ),
( r'^admin/', include( admin.site.urls ) ),
( r'^foo include( 'stackexchange.foo.urls' ) ),
( r'^bar include( 'stackexchange.bar.urls' ) ),
( r'^static/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT } ),
 )

You only need the 'static' definition for when you're testing using
'runserver'; Apache intercepts all of the /static/ URLs before Django sees
them in production.

I hope this helps.

- Craig -

On Wed, Dec 15, 2010 at 03:17, NoviceSortOf  wrote:

> On Dec 15, 8:08 am, mongoose  wrote:
> > > I'm trying to run projects on the back of it. For examplehttp://
> baseurl.com/mongoose/
> > > The projects run but the URL don't work properly because they all
> > > reference the base url. So for 'About Me' page it points tohttp://
> baseurl.com/aboutinsteadofhttp://baseurl.com/mongoose/about
> >
> > > Is this something i need to change in django or apache? Is what I'm
> > > trying to do even possible?
>
> I wrestled with something like this - as we needed a static homepage
> based on a django backend for one site.
>
> Per my recollection what I did was.
>
> * Apache httpd.conf required a location match adjustment something
> like.
>
> 
>  SetHandler None
> 
>
> * My url.py file needed this line
>  (r'^$', direct_to_template,{'template': 'index.html'}),
>
> * As well I landed up having to put the index.html into both
>  full static form in the .com root as well in the django template
> folder.
>  This was neccesary so people could load into the site as
>  "www.somewhere.com"
>   and while once in the django backend
>  "www.somewhere.com/index.html" would load for further
>   navigating.
>
> I hope that makes sense, there was a downside to this in that
> our web provider Verio's site management front end does not work
> with us resetting the SetHandler in the root. In any case
> most management of this site is done on the command line level.
>
> Not a perfect 

Re: testclient cannot find the template

2010-12-15 Thread Piotr Zalewa

This should work, is /success working in dev server?

zalun

On 10-12-15 03:53, Kenneth Gonsalves wrote:

On Wed, 2010-12-15 at 03:44 -0800, Piotr Zalewa wrote:

It looks like the test can't find the /success/ URL
and then tries to display a 404 error, but there is o 404.html
template

Do you have 404.html template created?

no 404 template - but why can it not find the /success/ url? Do I need
to import urls.py also?



--
blog http://piotr.zalewa.info
jobs http://webdev.zalewa.info
twit http://twitter.com/zalun
face http://www.facebook.com/zaloon

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: testclient cannot find the template

2010-12-15 Thread Kenneth Gonsalves
On Wed, 2010-12-15 at 17:23 +0530, Kenneth Gonsalves wrote:
> On Wed, 2010-12-15 at 03:44 -0800, Piotr Zalewa wrote:
> > It looks like the test can't find the /success/ URL
> > and then tries to display a 404 error, but there is o 404.html
> > template
> > 
> > Do you have 404.html template created? 
> 
> no 404 template - but why can it not find the /success/ url? Do I need
> to import urls.py also? 

solved - the url was wrong
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: testclient cannot find the template

2010-12-15 Thread Kenneth Gonsalves
On Wed, 2010-12-15 at 03:44 -0800, Piotr Zalewa wrote:
> It looks like the test can't find the /success/ URL
> and then tries to display a 404 error, but there is o 404.html
> template
> 
> Do you have 404.html template created? 

no 404 template - but why can it not find the /success/ url? Do I need
to import urls.py also?
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: testclient cannot find the template

2010-12-15 Thread Piotr Zalewa

Hi Kenneth,

It looks like the test can't find the /success/ URL
and then tries to display a 404 error, but there is o 404.html template

Do you have 404.html template created?

zalun

On 10-12-15 01:13, Kenneth Gonsalves wrote:

hi,

I am trying to write a test of a view with test client. My test is like
this:

class Testgetnum(unittest.TestCase):
 def setUp(self):
 self.client = Client()
 def testgetnum(self):
 response = self.client.post('/success/',{'id':1})
 self.assertEqual(response.status_code, 200)

but the test crashes since it cannot find the template mentioned in the
view. But the template is there in the correct directory pointed to by
settings. The error traceback is:

Traceback (most recent call
last):
   File "/home/lawgon/addition/../addition/addnums/tests.py", line 38, in
testgetnum
 response =
self.client.post('/success/',{'id':1})
   File "/usr/lib/python2.6/site-packages/django/test/client.py", line
444, in post
 response = super(Client, self).post(path, data=data,
content_type=content_type, **extra)
   File "/usr/lib/python2.6/site-packages/django/test/client.py", line
245, in post
 return
self.request(**r)
   File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py",
line 139, in get_response
 response = callback(request,
**param_dict)
   File "/usr/lib/python2.6/site-packages/django/utils/decorators.py",
line 89, in _wrapped_view
 response = view_func(request, *args,
**kwargs)
   File "/usr/lib/python2.6/site-packages/django/views/defaults.py", line
18, in page_not_found
 t = loader.get_template(template_name) # You need to create a
404.html template.
   File "/usr/lib/python2.6/site-packages/django/template/loader.py",
line 157, in get_template
 template, origin =
find_template(template_name)
   File "/usr/lib/python2.6/site-packages/django/template/loader.py",
line 138, in find_template
 raise
TemplateDoesNotExist(name)
TemplateDoesNotExist: 404.html



--
blog http://piotr.zalewa.info
jobs http://webdev.zalewa.info
twit http://twitter.com/zalun
face http://www.facebook.com/zaloon

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.



Update user page after thread execution

2010-12-15 Thread mart
Hello,

In my architecture, I send messages to a port object (implemented as a
queue in a thread). I'm giving callback function with the result of the
call.

For example, after filling the registration form,

# views.py
...
def createprofile(request):
...
gui_port.send_to(port_profile,('recordprofile',[arg1, arg2,..],
callback,
request))
return render_to_response('wait.html', locals())

def callback(request, status):
if status:
return render_to_response('success.html', locals())
else:
return render_to_response('fail.html', locals())


# profilemanager.py (the port object related to profiles)
...
# when received the message
try:
# some operations, update db,...
except:
# callback function with status = False
threading.Thread(target = msg[2], args = (msg[3],False)).start()
else:
# callback function with status = False
threading.Thread(target = msg[2], args = (msg[3],True)).start()


The problem is that (as expected) the callback function doesn't change
the user webpage when it happens.

Is there a way to do it (using AJAX maybe)

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Controlling File Downloads.

2010-12-15 Thread euan.godd...@googlemail.com
If you're using apache you might want to consider wiring your app to
generate mod_auth_token URLs and have apache receive these.

On Dec 15, 8:29 am, NoviceSortOf  wrote:
> What is the best way to allow authorized downloads
> to specific users in Django.
>
> We have 2 possible scenarios that could work for us.
>
> 1. A download directory where any user can download any
>    file in the folder.
>
> or
>
> 2. Granting specific rights to specific users to download a specific
> file
> or set of files.
>
> Any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



testclient cannot find the template

2010-12-15 Thread Kenneth Gonsalves
hi,

I am trying to write a test of a view with test client. My test is like
this:

class Testgetnum(unittest.TestCase):
def setUp(self):
self.client = Client()  
def testgetnum(self):
response = self.client.post('/success/',{'id':1})
self.assertEqual(response.status_code, 200)

but the test crashes since it cannot find the template mentioned in the
view. But the template is there in the correct directory pointed to by
settings. The error traceback is:

Traceback (most recent call
last):  

  File "/home/lawgon/addition/../addition/addnums/tests.py", line 38, in
testgetnum 
response =
self.client.post('/success/',{'id':1})  
 
  File "/usr/lib/python2.6/site-packages/django/test/client.py", line
444, in post  
response = super(Client, self).post(path, data=data,
content_type=content_type, **extra)
  File "/usr/lib/python2.6/site-packages/django/test/client.py", line
245, in post  
return
self.request(**r)   
 
  File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py",
line 139, in get_response   
response = callback(request,
**param_dict)   
   
  File "/usr/lib/python2.6/site-packages/django/utils/decorators.py",
line 89, in _wrapped_view 
response = view_func(request, *args,
**kwargs)  
  File "/usr/lib/python2.6/site-packages/django/views/defaults.py", line
18, in page_not_found  
t = loader.get_template(template_name) # You need to create a
404.html template.
  File "/usr/lib/python2.6/site-packages/django/template/loader.py",
line 157, in get_template  
template, origin =
find_template(template_name)
 
  File "/usr/lib/python2.6/site-packages/django/template/loader.py",
line 138, in find_template 
raise
TemplateDoesNotExist(name)  
  
TemplateDoesNotExist: 404.html 
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Controlling File Downloads.

2010-12-15 Thread NoviceSortOf

What is the best way to allow authorized downloads
to specific users in Django.

We have 2 possible scenarios that could work for us.

1. A download directory where any user can download any
   file in the folder.

or

2. Granting specific rights to specific users to download a specific
file
or set of files.

Any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: script adding FileField, no attribute chunks

2010-12-15 Thread urukay
Hi,

can any one help on this problem?

pic_file = os.path.join(settings.MEDIA_ROOT, 'signature
\invalid.png')
f = open(pic_file, 'r')
picture = InMemoryUploadedFile(
file=f,
field_name='image',
name='invalid_new.png',
content_type='image/png',
size=os.path.getsize(pic_file),
charset=None,
)
pic = DigitalSignaturePicture(kind=1, image=picture)
pic.save()

And i get this error:

Traceback (most recent call last):
  File "D:\Workspace\yau\py\manage.py", line 11, in 
execute_manager(settings)
  File "C:\Python25\lib\site-packages\django\core\management
\__init__.py", line 438, in execute_manager
utility.execute()
  File "C:\Python25\lib\site-packages\django\core\management
\__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python25\lib\site-packages\django\core\management\base.py",
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "C:\Python25\lib\site-packages\django\core\management\base.py",
line 218, in execute
output = self.handle(*args, **options)
  File "C:\Python25\lib\site-packages\django\core\management\base.py",
line 347, in handle
return self.handle_noargs(**options)
  File "D:\Workspace\yau\py\help\management\commands\helpupdate.py",
line 6, in handle_noargs
update_faq(silent=False)
  File "D:\Workspace\yau\py\help\updater.py", line 321, in update
DigitalSignatureHelpUpdater(silent).update()
  File "D:\Workspace\yau\py\help\updater.py", line 281, in update
pic.save()
  File "D:\Workspace\yau\ext\imagekit\models.py", line 145, in save
self._pre_cache()
  File "D:\Workspace\yau\ext\imagekit\models.py", line 110, in
_pre_cache
prop._create()
  File "D:\Workspace\yau\ext\imagekit\specs.py", line 63, in _create
self._img, self._fmt = self.spec.process(Image.open(fp),
self._obj)
  File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1980, in
open
raise IOError("cannot identify image file")
IOError: cannot identify image file

Thanks a lot

Radovan

On 1. Dec., 13:32 h., Tom Evans  wrote:
> On Wed, Dec 1, 2010 at 12:23 PM, Andrew Marder
>
>  wrote:
> > I'm trying to add a bunch of files from disk into my django database.
> > Here's the helper function I've written so far:
>
> > def django_file(path, field_name, content_type):
> >    # adapted from 
> > here:http://groups.google.com/group/django-users/browse_thread/thread/834f...
> >    from django.core.files.uploadedfile import InMemoryUploadedFile
> >    f = open(path)
> >    return InMemoryUploadedFile(
> >        file=f,
> >        field_name=field_name,
> >        name=file.name,
>
> This should be 'f.name', not 'file.name'. file is a built in class in
> python, and file.name is a member of that class, not your file name.
>
> Cheers
>
> Tom
>
> >        content_type=content_type,
> >        size=os.path.getsize(path),
> >        charset=None)
>
> > I'm calling it like so:
> > django_file("path-to-jpg-file", field_name="image",
> > content_type="image/jpeg")
>
> > Here's the error I'm getting:
> > Traceback (most recent call last):
> >  File "", line 1, in 
> >  File "/home/amarder/Documents/nmis/odk_dropbox/views.py", line 49,
> > in import_instances_folder
> >    f = django_file(xml_files[0], field_name="xml_file",
> > content_type="text/xml")
> >  File "/home/amarder/Documents/nmis/odk_dropbox/views.py", line 70,
> > in django_file
> >    charset=None)
> >  File "/home/amarder/Documents/environments/nmis/lib/python2.6/site-
> > packages/django/core/files/uploadedfile.py", line 90, in __init__
> >    super(InMemoryUploadedFile, self).__init__(file, name,
> > content_type, size, charset)
> >  File "/home/amarder/Documents/environments/nmis/lib/python2.6/site-
> > packages/django/core/files/uploadedfile.py", line 30, in __init__
> >    super(UploadedFile, self).__init__(file, name)
> >  File "/home/amarder/Documents/environments/nmis/lib/python2.6/site-
> > packages/django/core/files/base.py", line 17, in __init__
> >    self.name = name
> >  File "/home/amarder/Documents/environments/nmis/lib/python2.6/site-
> > packages/django/core/files/uploadedfile.py", line 46, in _set_name
> >    name = os.path.basename(name)
> >  File "/home/amarder/Documents/environments/nmis/lib/python2.6/
> > posixpath.py", line 111, in basename
> >    i = p.rfind('/') + 1
> > AttributeError: 'member_descriptor' object has no attribute 'rfind'
>
> > Any suggestions?
>
> > Andrew
>
> > On Nov 16, 4:36 pm, Mitch Anderson  wrote:
> >> On Tue, Nov 16, 2010 at 3:28 AM, Tom Evans  
> >> wrote:
> >> > Django doesn't want a python file or text for a django file field, it
> >> > wants a django.core.files.File. I find the easiest one to 

Re: running projects on the back of a base URL and having issues with the homepage

2010-12-15 Thread NoviceSortOf
On Dec 15, 8:08 am, mongoose  wrote:
> > I'm trying to run projects on the back of it. For 
> > examplehttp://baseurl.com/mongoose/
> > The projects run but the URL don't work properly because they all
> > reference the base url. So for 'About Me' page it points 
> > tohttp://baseurl.com/aboutinsteadofhttp://baseurl.com/mongoose/about
>
> > Is this something i need to change in django or apache? Is what I'm
> > trying to do even possible?

I wrestled with something like this - as we needed a static homepage
based on a django backend for one site.

Per my recollection what I did was.

* Apache httpd.conf required a location match adjustment something
like.


  SetHandler None


* My url.py file needed this line
  (r'^$', direct_to_template,{'template': 'index.html'}),

* As well I landed up having to put the index.html into both
  full static form in the .com root as well in the django template
folder.
  This was neccesary so people could load into the site as
  "www.somewhere.com"
   and while once in the django backend
  "www.somewhere.com/index.html" would load for further
   navigating.

I hope that makes sense, there was a downside to this in that
our web provider Verio's site management front end does not work
with us resetting the SetHandler in the root. In any case
most management of this site is done on the command line level.

Not a perfect solution but one that works, I'm open for other
suggestions.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.