Re: ./manage.py collectstatic does not collect my folder

2012-10-06 Thread easypie
Wonderful! I had to add in the files I wanted override inside 
STATICFILES_DIRS. It works now.

On Saturday, October 6, 2012 11:01:39 PM UTC-7, Xavier Ordoquy wrote:
>
> Hi,
>
> Django static collects files that are:
> - in the application's static directory
> - in the directories listed by STATICFILES_DIRS
>
> If using the default storage, files and directories are copied into the 
> STATIC_ROOT directory and should be served at the location specified by 
> STATIC_URL
>
> The order in which the applications are declared is important.
> If I'm not mistaken, the files in STATICFILES_DIRS will override the 
> application's static directories.
>
> Regards,
> Xavier Ordoquy,
> Linovia.
>
> Le 7 oct. 2012 à 06:52, easypie > a 
> écrit :
>
> I have my project setup so ./manage.py collectstatic will upload all the 
> files in /static/ onto the Amazon S3 server. The only problem is that I 
> have a folder located in .../static/theme/{site layout gfx} that doesn't 
> get collected to the S3 server. I understand that collectstatic ?copies all 
> files located in app/static to the location provided by STATIC_URL. But 
> what about those .css and image files I want to override? For example, I 
> want to override the admin's .css files so I  copy that over to the 
> /static/ folder in my project's root but when I run ./manage.py 
> collectstatic it only moves the admin's .css files located in 
> ../site-packages/django/.../css/{..css} and not the css file that I copied 
> over and then edited?  
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/1A2_Kn1PH1wJ.
> To post to this group, send email to django...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Us2xCBw2qFMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ./manage.py collectstatic does not collect my folder

2012-10-06 Thread Xavier Ordoquy
Hi,

Django static collects files that are:
- in the application's static directory
- in the directories listed by STATICFILES_DIRS

If using the default storage, files and directories are copied into the 
STATIC_ROOT directory and should be served at the location specified by 
STATIC_URL

The order in which the applications are declared is important.
If I'm not mistaken, the files in STATICFILES_DIRS will override the 
application's static directories.

Regards,
Xavier Ordoquy,
Linovia.

Le 7 oct. 2012 à 06:52, easypie  a écrit :

> I have my project setup so ./manage.py collectstatic will upload all the 
> files in /static/ onto the Amazon S3 server. The only problem is that I have 
> a folder located in .../static/theme/{site layout gfx} that doesn't get 
> collected to the S3 server. I understand that collectstatic ?copies all files 
> located in app/static to the location provided by STATIC_URL. But what about 
> those .css and image files I want to override? For example, I want to 
> override the admin's .css files so I  copy that over to the /static/ folder 
> in my project's root but when I run ./manage.py collectstatic it only moves 
> the admin's .css files located in ../site-packages/django/.../css/{..css} and 
> not the css file that I copied over and then edited? 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/1A2_Kn1PH1wJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



./manage.py collectstatic does not collect my folder

2012-10-06 Thread easypie
I have my project setup so ./manage.py collectstatic will upload all the 
files in /static/ onto the Amazon S3 server. The only problem is that I 
have a folder located in .../static/theme/{site layout gfx} that doesn't 
get collected to the S3 server. I understand that collectstatic ?copies all 
files located in app/static to the location provided by STATIC_URL. But 
what about those .css and image files I want to override? For example, I 
want to override the admin's .css files so I  copy that over to the 
/static/ folder in my project's root but when I run ./manage.py 
collectstatic it only moves the admin's .css files located in 
../site-packages/django/.../css/{..css} and not the css file that I copied 
over and then edited? 

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



Re: Django tutorial question

2012-10-06 Thread TJ Marbois
Ah ok thanks was just curious as to why it was still lingering if it 
wasn't used in the example.

just a tiny bit confusing but all still worked!  - thanks for the reply.

Tj

On Sunday, October 7, 2012 12:26:12 AM UTC-4, Lee Hinde wrote:
>
> TJ Marbois wrote: 
>
> Hi 
>
> going thru the Django tutorial - and got to this part:
>
>
> https://docs.djangoproject.com/en/1.4/intro/tutorial03/#decoupling-the-urlconfs
>
> my editor has a python lint program running...and it complains about 
> 'include' at the import being written but unused...
>
> is there any reason this is left in for the tutorial? or is this just a 
> not needed leftover or error?  I just want to be sure I am not missing some 
> detailbecause it works with or without...Im just wondering why they 
> left it in.
>
> from django.conf.urls import patterns, include, url
> urlpatterns = patterns('polls.views',
> url(r'^$', 'index'),
> url(r'^(?P\d+)/$', 'detail'),
> url(r'^(?P\d+)/results/$', 'results'),
> url(r'^(?P\d+)/vote/$', 'vote'),)
>
> -- 
>
> It's not used in that example. It is a common pattern to use it in more 
> complex apps.  It's explained here: 
> https://docs.djangoproject.com/en/1.4/topics/http/urls/#include
>
>
>
>  

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



Re: Django tutorial question

2012-10-06 Thread Lee Hinde

TJ Marbois wrote:

Hi

going thru the Django tutorial - and got to this part:

https://docs.djangoproject.com/en/1.4/intro/tutorial03/#decoupling-the-urlconfs

my editor has a python lint program running...and it complains about 
'include' at the import being written but unused...


is there any reason this is left in for the tutorial? or is this just 
a not needed leftover or error?  I just want to be sure I am not 
missing some detailbecause it works with or without...Im just 
wondering why they left it in.


from  django.conf.urls  import  patterns,  include,  url

urlpatterns  =  patterns('polls.views',
 url(r'^$',  'index'),
 url(r'^(?P\d+)/$',  'detail'),
 url(r'^(?P\d+)/results/$',  'results'),
 url(r'^(?P\d+)/vote/$',  'vote'),
)
--
It's not used in that example. It is a common pattern to use it in more 
complex apps.  It's explained here: 
https://docs.djangoproject.com/en/1.4/topics/http/urls/#include




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



Problem with URL configuration - cannot use absolute URLs in my case

2012-10-06 Thread Rohit Banga
Hi

I have a website at example.com/mywebsite. All URL requests directed to 
this URL are directed to my app.

Now I have the following project structure

   mywebsiteroot/
  -- myapp/
   -- manage.py
   -- myapp/
 --templates/
 --settings.py
 --models.py
 --views.py


When my base.html template includes a link "mylink" which shows some 
information.
On the home page this works fine. my django app receives a URL request 
for example.com/mywebsite/mylink which I serve using base.html template.

Now I extend the base.html template elsewhere in another view 
mylink/.
In that view the link points to example.com/mywebsite/mylink/mylink which 
is obviously wrong. If I use an absolute link /mylink; I get a request at 
example.com/mylink and not example.com/mywebsite/mylink which is also wrong.

So how do I code my url conf / view / template in order to be independent 
of mywebsite name.
Is there anything wrong with the way I am wiring up my application.

Thanks in Advance!

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



Re: Django performance vs others

2012-10-06 Thread Amirouche Boubekki
Héllo again,


I was going to send the message in django-users then python-list then I
though it wasn't good idea... If you think otherwise feel free to FW the
discussion to the relevant list.


First, sorry Stan for have been rude and using a rude language with you.

What is wrong with hello world application if you are testing web
>> application stack?
>>
>
> I Moonlight (or maybe Andriy ?). Some thoughts :
>
>1. Don't be directly involved in a product you are benchmarking
>against. that's bad
>
> There is no independant consultant that would do this for free on a
software that enters the market with no contracts in sight, especially if
his or her products is not the best. I think that the benchmarks being
opensource are reproducables, so the results are real, even if they might
not be relevant, whatever the guy who does them.


>
>1. Make a relevant bench for the conclusion you are claiming. Print
>"Hello world" is not a benchmark to say a framework is faster than another
>one. Look at graphical card benchs. They don't display just a rotating cube
>at very low resolution with 4 colors
>
> I'm not into 3D Graphics that much, but

   1. It involves a lot of back and forth between user code and the graphic
   card, which involves several level of cachings with complex
   algorithms, this is not relevant to Web dev
   2. Maybe jit optimisation or any code optimisation which are only
   relevant on heavy programs, which is only relevant to heavy computation,
   hence not relevant to Web dev per se, since if you do a celery call, this
   is the same call on every Python Web framework


>1. Be scientifically rigorous. Every framework make stuff under the
>hood when you initialize a project that you can't disregard because the
>impact is high. Stacks and hooks (auth, session, localization) that can be
>tuned (or not) in your project settings for instance. So the same "Hello
>World" (which is only the tip of the iceberg) can run 100 times faster
>according to your settings.
>
> Raw speed of a vanilla project is also interesting, if tuning will get a
program to better performance, then both frameworks will improve with
tuning, which might not change the winner. Getting best performance on
vanilla project is what every project should look for if it doesn't involve
insane settings, fsync=off, Caching every page 1 hour isn't a sane default,
using request bound transactions might be etc...


> The problem with Hello World is that it is way too simple, an
> insignificant parameter in the numerous/heterogenous/significant other
> parameters.
>

Let's start the discussion for real about benchmarking Web frameworks and
build a list of the different configurations we need to tests to make it
relevant:

- Render a plain template (done)
- Render a cached template
- Render a template with a cached body response
- Render a template with constants provided by the view
- Render a cached template with constants provided by the view
- Render a template with constants provided by the view with cached body
response
- Render a template with data from a database query (any query will do the
job, we are testing the ORM)
- Render a cached template with data from a database query
- Render a template with a cached query against a database
- Render a cached template with a cached query against a database
- Render a template with a query database with a cached body response

I think some of this tests are identical.

Tell me if this tests are relevant and if you know any others ?



> I do not say that this bench is absolutely useless. It can be used to show
> a regression, a bug, test the Apache stack.
>
Not to make framework comparisons.
>

Of course it is, getting used to a new API is possible, it's an investment
of scale compared to pay more that what you would pay with an equivalent
feature-wise framework, that you will pay *forever* if you continue to use
the same framework.


>
>
>
>> Choosing framework X over Y doesn't guarantee any success to project.
>> Good thing to know your framework has a limit... that also tells me how
>> effective one or other implemented... I guess it tells that.
>>
>> I have had no idea until recently that django template are sooo slow...
>> other engines do the same... but spent less time. What the cool feature
>> prevent it for rendering it faster?
>>
>
> I think this is not a 
> scoopthat
>  Django template engine is not the fastest and you are free
> to use another 
> one.
> But I would like to say, if you are in a serious business, don't give a
> fuck. This is the last reason to fail a real-life project and a pretty
> low-benefit optimization .
> Ok, this is important, but don't over-estimate it.
>

True, most of the time you get the project out as fast as possible, the
client pay the

Django tutorial question

2012-10-06 Thread TJ Marbois
Hi

going thru the Django tutorial - and got to this part:

https://docs.djangoproject.com/en/1.4/intro/tutorial03/#decoupling-the-urlconfs

my editor has a python lint program running...and it complains about 
'include' at the import being written but unused...

is there any reason this is left in for the tutorial? or is this just a not 
needed leftover or error?  I just want to be sure I am not missing some 
detailbecause it works with or without...Im just wondering why they 
left it in.

from django.conf.urls import patterns, include, url
urlpatterns = patterns('polls.views',
url(r'^$', 'index'),
url(r'^(?P\d+)/$', 'detail'),
url(r'^(?P\d+)/results/$', 'results'),
url(r'^(?P\d+)/vote/$', 'vote'),)

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



Re: Edit two related models on one form

2012-10-06 Thread Fred Stluka

Felix,

I'm new to Python and Django, so others may be able to improve
on this, but I had a similar scenario recently and this was my
solution.

I used 2 ModelForms in the same HTML template.  My view method
looks something like (edited to use your question/answer instead
of my original donor/donation objects):


def question_and_answer(request):
"""
Show blank question and answer form, or save question and answer,
or re-show form with errors.

Handles 3 cases:
- Show empty editable form for new questions and answer (GET)
- Save details for new question and answer (POST, valid form)
- Show errors/re-prompt for new question and answer (POST, invalid 
form)


Does not allow edit of existing question or answer.
"""
if request.method == 'POST':
answerform = AnswerForm(request.POST)
questionform = QuestionForm(request.POST)
if questionform.is_valid() and answerform.is_valid():
questionform.save()
answerform.instance.question = questionform.instance
answerform.save()

return HttpResponseRedirect( ... )
else:
answerform = AnswerForm()
questionform = QuestionForm()

return render_to_response(
'question_and_answer.html',
{'answerform': answerform,
 'questionform': questionform,
},
context_instance=RequestContext(request)
)



You'll have to enhance the above to support multiple answers.
Also, to allow editing of existing questions and answers.  I have
code for that scenario too, if you can't figure it out, but this
should get you started.

Anyone else have improvements on this?

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 10/6/12 5:28 PM, Felix Schlitter wrote:

Hello,

I have a pretty basic problem that I cannot find any reference for to 
solve. Let's say I have the following relationship scenario: *question 
*and *answer*, where *each* *question* may have up to *four answers*, 
but *each* *answer* can only have *one question*. I concluded to put a 
/ForeignKey/ on the answer model.


The problem, however, comes when I want to add a new question. 
Currently, I would need to first add a question by itself and 
afterwards create new answers and reference the question. Optimally, I 
would like to be able to create the necessary answers right from the 
question form and associate them with the question upon saving. This 
of course also implies that upon load a form for a certain question, 
the already associated answers will be loaded.


Do I handle the form logic in a ModelForm subclass, on the view or is 
there already pluggable app for this that I missed?


Seems like this scenario would be a pretty common problem,

Felix







--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ikvVkFXPhKUJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Edit two related models on one form

2012-10-06 Thread Felix Schlitter
Hello,

I have a pretty basic problem that I cannot find any reference for to 
solve. Let's say I have the following relationship scenario: *question *and 
*answer*, where *each* *question* may have up to *four answers*, but *each* 
*answer* can only have *one question*. I concluded to put a *ForeignKey* on 
the answer model.

The problem, however, comes when I want to add a new question. Currently, I 
would need to first add a question by itself and afterwards create new 
answers and reference the question. Optimally, I would like to be able to 
create the necessary answers right from the question form and associate 
them with the question upon saving. This of course also implies that upon 
load a form for a certain question, the already associated answers will be 
loaded.

Do I handle the form logic in a ModelForm subclass, on the view or is there 
already pluggable app for this that I missed?

Seems like this scenario would be a pretty common problem,

Felix







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



Re: django-guardian 404 on save.

2012-10-06 Thread Nicolas Emiliani
On Sat, Oct 6, 2012 at 4:41 PM, Nicolas Emiliani  wrote:

> Hi,
>
> I'm implementing django-guardian within the admin site and I'm having the
> following issue.
> If I create a model instance through the admin panel and then try to
> modify it
> (even using the super admin) I get a 404 error.
>

Replying to myself. The problem was not with django-guardian the problem
was the method
change_view at the model.Admin, still do not know why, I'll repost.

Sorry for the inconvenience

-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

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



Re: Should we have a database independent SQL like query language in Django?

2012-10-06 Thread Jeremy Sandell
On Sat, Oct 6, 2012 at 10:38 AM, Yugal Jindle  wrote:

> *Note :*
>
>  - I know we have `Django ORM` already that keeps things database
> independent and converts to the database specific `SQL` queries.
>  - Once things starts getting complicated it is preferred to write `raw
> SQL` queries for better efficiency.
>  - When you write `raw sql` queries your code gets trapped with the
> database you are using.
>  - I also understand its important to use the full power of your database
> that can-not be achieved with the `django orm` alone.
>
> *My Question :*
>
>  - Until I use any database specific feature, why should one be trapped
> with the database.
>  - For instance :
>
> We have a query with multiple joins and we decided to write a raw sql
>> query. Now, that makes my website `postgres` specific. Even when I
>> have not used any postgres specific feature.
>
>
> I feel there should be some `fake sql` language which can translate to any
> database's sql query. Even Django's ORM can be built over it. So, that if
> you go out of ORM but not database specific - you can still remain database
> independent.
>
> I asked the same question to `Jacob Kaplan Moss` (In person) :
>
>  - He advised me to stay with the database that I like and endure its
> whole power, to which I agree. But my point was not that we should be
> `database independent`.
>  - My point is we should be database independent until we use a database
> specific feature.
>
> *
> *
> *Please explain, why should be there a `fake sql` layer over the actual
> sql ?*
>
>

If it helps, there's already a database independent 'fake sql' package
available for Python - it's called SQLAlchemy. Granted, it's not "built in"
to Django, as in being tightly coupled with the admin interface like
Django's ORM, but it certainly can be (and has been) used for what you're
describing.

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



Re: Why can't I activate the admin site?

2012-10-06 Thread Joel Goldstick
On Sat, Oct 6, 2012 at 10:24 AM, Dae_James  wrote:
> My urls is:
> from django.conf.urls import patterns, include, url
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'test6.views.home', name='home'),
> # url(r'^test6/', include('test6.foo.urls')),
>
> # Uncomment the admin/doc line below to enable admin documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> # Uncomment the next line to enable the admin:
> url(r'^admin/', include(admin.site.urls)),
> )
>
This looks ok.  Try typing in a nonsense url like http://localhost:8000/hi

It won't match anything, but it will list the available urls that you
have.  This may give you a clue as to what is going wrong


> Just uncommented three sentences.
>
> On Friday, October 5, 2012 8:35:15 PM UTC+8, Tom Evans wrote:
>>
>> On Fri, Oct 5, 2012 at 9:18 AM, Dae_James  wrote:
>> > I created a new django project and did the following three things:
>> > 1, Uncomment "django.contrib.admin" in the INSTALLED_APPS setting.
>> > 2, Run python manage.py syncdb. Since you have added a new application
>> > to
>> > INSTALLED_APPS, the database tables need to be updated.
>> > 3, Edit your mysite/urls.py file and uncomment the lines that reference
>> > the
>> > admin – there are three lines in total to uncomment.
>> >
>> > And then typed in "python manage.py runserver" to start server.
>> >
>> > After all this, when I visit http://127.0.0.1:8000/admin/ , welcome site
>> > displayed instead of the admin site.
>> > What's the matter, please ? I'm a new hand to django.
>> >
>>
>> Can you show your urls? I expect the one for 'welcome site' matches
>> the url for the admin site before the admin url is tested, and so is
>> routed there instead.
>>
>> Cheers
>>
>> Tom
>


-- 
Joel Goldstick

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



Re: Should we have a database independent SQL like query language in Django?

2012-10-06 Thread Nick Santos
I agree with Babatunde. I think it would be too much of a barrier to entry
and tries to solve some of the problems that the ORM/SQL in general solve
or are intended to solve (generalizability). I'd personally rather enhance
the ORM where necessary, or suggest that if you plan on switching between
databases in an application with raw sql, you consider some method for
setting a flag that indicates which version of raw sql to send. But maybe
I'm underestimating the need for this sort of feature.
-Nick

On Sat, Oct 6, 2012 at 9:59 AM, Babatunde Akinyanmi wrote:

> IMO, 'fake sql' would be another layer of abstraction *like the the
> ORM* over different databases that don't work the same way. The result
> would be the same. Since the ORM works fine, the ORM could be improved
> to cater for some of these more complex cases. It leaves using django
> a matter of learning python and not python and another sql language.
> My 50 kobo
>
> On 10/6/12, Yugal Jindle  wrote:
> > *Note :*
> >
> >  - I know we have `Django ORM` already that keeps things database
> > independent and converts to the database specific `SQL` queries.
> >  - Once things starts getting complicated it is preferred to write `raw
> > SQL` queries for better efficiency.
> >  - When you write `raw sql` queries your code gets trapped with the
> > database you are using.
> >  - I also understand its important to use the full power of your database
> > that can-not be achieved with the `django orm` alone.
> >
> > *My Question :*
> >
> >  - Until I use any database specific feature, why should one be trapped
> > with the database.
> >  - For instance :
> >
> > We have a query with multiple joins and we decided to write a raw sql
> >> query. Now, that makes my website `postgres` specific. Even when I
> >> have not used any postgres specific feature.
> >
> >
> > I feel there should be some `fake sql` language which can translate to
> any
> > database's sql query. Even Django's ORM can be built over it. So, that if
> > you go out of ORM but not database specific - you can still remain
> database
> >
> > independent.
> >
> > I asked the same question to `Jacob Kaplan Moss` (In person) :
> >
> >  - He advised me to stay with the database that I like and endure its
> whole
> >
> > power, to which I agree. But my point was not that we should be `database
> > independent`.
> >  - My point is we should be database independent until we use a database
> > specific feature.
> >
> > *
> > *
> > *Please explain, why should be there a `fake sql` layer over the actual
> sql
> >
> > ?*
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/cQW4Vpc9ueYJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Should we have a database independent SQL like query language in Django?

2012-10-06 Thread Babatunde Akinyanmi
IMO, 'fake sql' would be another layer of abstraction *like the the
ORM* over different databases that don't work the same way. The result
would be the same. Since the ORM works fine, the ORM could be improved
to cater for some of these more complex cases. It leaves using django
a matter of learning python and not python and another sql language.
My 50 kobo

On 10/6/12, Yugal Jindle  wrote:
> *Note :*
>
>  - I know we have `Django ORM` already that keeps things database
> independent and converts to the database specific `SQL` queries.
>  - Once things starts getting complicated it is preferred to write `raw
> SQL` queries for better efficiency.
>  - When you write `raw sql` queries your code gets trapped with the
> database you are using.
>  - I also understand its important to use the full power of your database
> that can-not be achieved with the `django orm` alone.
>
> *My Question :*
>
>  - Until I use any database specific feature, why should one be trapped
> with the database.
>  - For instance :
>
> We have a query with multiple joins and we decided to write a raw sql
>> query. Now, that makes my website `postgres` specific. Even when I
>> have not used any postgres specific feature.
>
>
> I feel there should be some `fake sql` language which can translate to any
> database's sql query. Even Django's ORM can be built over it. So, that if
> you go out of ORM but not database specific - you can still remain database
>
> independent.
>
> I asked the same question to `Jacob Kaplan Moss` (In person) :
>
>  - He advised me to stay with the database that I like and endure its whole
>
> power, to which I agree. But my point was not that we should be `database
> independent`.
>  - My point is we should be database independent until we use a database
> specific feature.
>
> *
> *
> *Please explain, why should be there a `fake sql` layer over the actual sql
>
> ?*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/cQW4Vpc9ueYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



Should we have a database independent SQL like query language in Django?

2012-10-06 Thread Yugal Jindle
*Note :*

 - I know we have `Django ORM` already that keeps things database 
independent and converts to the database specific `SQL` queries.
 - Once things starts getting complicated it is preferred to write `raw 
SQL` queries for better efficiency.
 - When you write `raw sql` queries your code gets trapped with the 
database you are using.
 - I also understand its important to use the full power of your database 
that can-not be achieved with the `django orm` alone.

*My Question :*

 - Until I use any database specific feature, why should one be trapped 
with the database.
 - For instance :

We have a query with multiple joins and we decided to write a raw sql
> query. Now, that makes my website `postgres` specific. Even when I
> have not used any postgres specific feature.


I feel there should be some `fake sql` language which can translate to any 
database's sql query. Even Django's ORM can be built over it. So, that if 
you go out of ORM but not database specific - you can still remain database 
independent.

I asked the same question to `Jacob Kaplan Moss` (In person) :

 - He advised me to stay with the database that I like and endure its whole 
power, to which I agree. But my point was not that we should be `database 
independent`.
 - My point is we should be database independent until we use a database 
specific feature.

*
*
*Please explain, why should be there a `fake sql` layer over the actual sql 
?*

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



Re: Best practice of subclassing default/3rd part apps?

2012-10-06 Thread Xun Yang
Hi ke1g! Thanks a lot for the explanation! I'm currently using both the 
second and third approach for the problem, a utility app for a few things 
and embedding "registration" app in my project (Seeing it hasn't updated 
for years, I suppose it's safe to have it here and modify as I want). 
At certain point I may need to break utility app into new apps as the 
project goes. I'm also getting curious about the "requirements.txt" you 
talked about, seems like I need some good knowledge about version control.

I hope the Django community has a plan of moving the support group out of 
Google Groups, which feels like a last century product and is hard to both 
keep track and read...

On Friday, October 5, 2012 10:25:27 PM UTC+2, ke1g wrote:
>
> If your changes are limited to templates, there is an easy standard 
> approach: 
>
> Set TEMPLATE_DIRS to something reasonable. 
> Include the file system template loader in TEMPLATE_LOADERS 
> *before* the app loader.  (This is probably already true.) 
>
> Copy the templates you need to change to the same sub path of your 
> templates directory as they were to the app's templates directory, and 
> edit your copy.  E.g.; if the foo app calls out a template as 
> "foo/bar.html", and the original is in 
> ".../site-packages/foo/templates/foo/bar.html", and you put your 
> version in ".../templates/foo/bar.html", your version will be found 
> first, and thus will be the one used. 
>
> If you need to fiddle a view, you need to recreate the view (or, if 
> applicable, create a function that calls the view and massages the 
> arguments and/or the results) in a module of your own that is 
> available from sys.path, e.g.; ".../my_utils/extra_views.py", and fix 
> urls.py to call it instead.  You can do this even if you are 
> "include()"ing the apps urls module from your urls, since you can put 
> an expression that matches a specific on or the app's sub paths before 
> the include, and the other sub paths will still be handled by the 
> app's urls. 
>
> Fancier changes usually lead to cloning the app into your project 
> directory and putting it under your revision control system, rather 
> than in requirements.txt (or equivalent).  (Your project directory 
> needs to be, and typically will be, earlier on sys.path than 
> site-packages or (yuck) dist-packages.) 
>
> Installing upgrades to other packages CAN (but usually doesn't) break 
> any of these approaches, requiring you to track down the interaction 
> and edit your copy. 
>
> On Thu, Oct 4, 2012 at 5:53 AM, Xun Yang > 
> wrote: 
> > Quite often I have to make small changes to the original code when I'm 
> using 
> > default/3rd part apps. Take an example of setting constrains for 
> password, 
> > the default SetPasswordForm in django.contrib.auth.forms and 
> > RegistrationForm in django-registration don't have any. So I have to 
> > subclass them and add in the checks. So is there a best practice of 
> where to 
> > place these subclasses? As in one project I may need to define many 
> > subclasses from various default/3rd part apps, should I create a utility 
> app 
> > and put all of them there? (From the past experience I'm a bit concerned 
> > about this, as it could be a source of pain when I moved stuff from test 
> to 
> > WSGI/apache) 
> > 
> > Thanks for the help! 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/django-users/-/IOBUs2rA9UoJ. 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/mR0mzEPyGeMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Why can't I activate the admin site?

2012-10-06 Thread Dae_James
My urls is:
from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'test6.views.home', name='home'),
# url(r'^test6/', include('test6.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)

Just uncommented three sentences.

On Friday, October 5, 2012 8:35:15 PM UTC+8, Tom Evans wrote:
>
> On Fri, Oct 5, 2012 at 9:18 AM, Dae_James > 
> wrote: 
> > I created a new django project and did the following three things: 
> > 1, Uncomment "django.contrib.admin" in the INSTALLED_APPS setting. 
> > 2, Run python manage.py syncdb. Since you have added a new application 
> to 
> > INSTALLED_APPS, the database tables need to be updated. 
> > 3, Edit your mysite/urls.py file and uncomment the lines that reference 
> the 
> > admin – there are three lines in total to uncomment. 
> > 
> > And then typed in "python manage.py runserver" to start server. 
> > 
> > After all this, when I visit http://127.0.0.1:8000/admin/ , welcome 
> site 
> > displayed instead of the admin site. 
> > What's the matter, please ? I'm a new hand to django. 
> > 
>
> Can you show your urls? I expect the one for 'welcome site' matches 
> the url for the admin site before the admin url is tested, and so is 
> routed there instead. 
>
> Cheers 
>
> Tom 
>

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



Re: Django Admin asks password every operation

2012-10-06 Thread Victor Rocha
Depending on what exactly you want to accomplish to match the root to a 
url, I do as follow:
url(r'^$', 'earth.views.Home'),

However, it is sometimes good to have a default page if a request didnt 
match the url requested (I would use this as the very last rule, otherwise 
it will catch every request):
url(r'^', 'earth.views.Home'),

As for your origina question, are you sure you have your session middleware 
activated?

On Saturday, October 6, 2012 9:53:36 AM UTC-4, Stefano T wrote:
>
> What i want is to match the root of my website with a url.
>
> On Saturday, October 6, 2012 12:53:08 AM UTC+2, ke1g wrote:
>>
>> All urls match this.  The regular expression says "any URL that starts 
>> from the beginning, no matter what follows.  I suspect that you want 
>> 'r^$' 
>>
>> Bill 
>>
>> On Fri, Oct 5, 2012 at 2:15 PM, Stefano T 
>>  wrote: 
>> > wait i may have spotted out the problem: 
>> > if i've an app, is this the correct url pattern for the homepage? 
>> > 
>> > url(r'^', 'earth.views.Home'), 
>> > 
>> > or does it take ll the urls? 
>> > 
>> > 
>> > On Friday, October 5, 2012 8:10:09 PM UTC+2, Stefano T wrote: 
>> >> 
>> >> i didn't est SESSION_COOKIE_AGE anywhere, so i suppose it's set to its 
>> >> default value. 
>> >> Cookies are enabled. 
>> >> i'm facing the problem in chrome (i deleted all the browser data, 
>> nothing 
>> >> changed) 
>> >> with FF it works. 
>> >> Before it was working with chrome, suddently it stopped. 
>> >> 
>> >> On Friday, October 5, 2012 7:32:16 PM UTC+2, Larry@gmail.comwrote: 
>> >>> 
>> >>> On Fri, Oct 5, 2012 at 10:57 AM, Stefano T 
>> >>>  wrote: 
>> >>> > Hi all. 
>> >>> > i'm new to django and i'm facing a problem i can't solve so far. 
>> >>> > Basically, when i log in in the admin part, every operation i do it 
>> >>> > ask me for the login. doesn't matter which browser i user, it's 
>> always 
>> >>> > the same. 
>> >>> > at the beginning it was acting normally: once logged in i stay 
>> logged 
>> >>> > in until the logout. 
>> >>> > idea? 
>> >>> 
>> >>> What is SESSION_COOKIE_AGE set to in your settings file? Or are 
>> >>> cookies disabled for your browser? 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "Django users" group. 
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msg/django-users/-/jJ7LrE2_TC0J. 
>> > 
>> > To post to this group, send email to django...@googlegroups.com. 
>> > To unsubscribe from this group, send email to 
>> > django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/870HncbaK18J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Admin asks password every operation

2012-10-06 Thread Babatunde Akinyanmi
I suspect Bill's answer is what you are looking for as regards the
url. However, it won't solve the password problem

On 10/6/12, Stefano T  wrote:
> What i want is to match the root of my website with a url.
>
> On Saturday, October 6, 2012 12:53:08 AM UTC+2, ke1g wrote:
>>
>> All urls match this.  The regular expression says "any URL that starts
>> from the beginning, no matter what follows.  I suspect that you want
>> 'r^$'
>>
>> Bill
>>
>> On Fri, Oct 5, 2012 at 2:15 PM, Stefano T
>> > wrote:
>> > wait i may have spotted out the problem:
>> > if i've an app, is this the correct url pattern for the homepage?
>> >
>> > url(r'^', 'earth.views.Home'),
>> >
>> > or does it take ll the urls?
>> >
>> >
>> > On Friday, October 5, 2012 8:10:09 PM UTC+2, Stefano T wrote:
>> >>
>> >> i didn't est SESSION_COOKIE_AGE anywhere, so i suppose it's set to its
>> >>
>> >> default value.
>> >> Cookies are enabled.
>> >> i'm facing the problem in chrome (i deleted all the browser data,
>> nothing
>> >> changed)
>> >> with FF it works.
>> >> Before it was working with chrome, suddently it stopped.
>> >>
>> >> On Friday, October 5, 2012 7:32:16 PM UTC+2, Larry@gmail.comwrote:
>> >>
>> >>>
>> >>> On Fri, Oct 5, 2012 at 10:57 AM, Stefano T
>> >>>  wrote:
>> >>> > Hi all.
>> >>> > i'm new to django and i'm facing a problem i can't solve so far.
>> >>> > Basically, when i log in in the admin part, every operation i do it
>> >>> >
>> >>> > ask me for the login. doesn't matter which browser i user, it's
>> always
>> >>> > the same.
>> >>> > at the beginning it was acting normally: once logged in i stay
>> logged
>> >>> > in until the logout.
>> >>> > idea?
>> >>>
>> >>> What is SESSION_COOKIE_AGE set to in your settings file? Or are
>> >>> cookies disabled for your browser?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/django-users/-/jJ7LrE2_TC0J.
>> >
>> > To post to this group, send email to
>> > django...@googlegroups.com.
>>
>> > To unsubscribe from this group, send email to
>> > django-users...@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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Qj_oADXTnvIJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



Re: Django Admin asks password every operation

2012-10-06 Thread Stefano T
What i want is to match the root of my website with a url.

On Saturday, October 6, 2012 12:53:08 AM UTC+2, ke1g wrote:
>
> All urls match this.  The regular expression says "any URL that starts 
> from the beginning, no matter what follows.  I suspect that you want 
> 'r^$' 
>
> Bill 
>
> On Fri, Oct 5, 2012 at 2:15 PM, Stefano T 
> > wrote: 
> > wait i may have spotted out the problem: 
> > if i've an app, is this the correct url pattern for the homepage? 
> > 
> > url(r'^', 'earth.views.Home'), 
> > 
> > or does it take ll the urls? 
> > 
> > 
> > On Friday, October 5, 2012 8:10:09 PM UTC+2, Stefano T wrote: 
> >> 
> >> i didn't est SESSION_COOKIE_AGE anywhere, so i suppose it's set to its 
> >> default value. 
> >> Cookies are enabled. 
> >> i'm facing the problem in chrome (i deleted all the browser data, 
> nothing 
> >> changed) 
> >> with FF it works. 
> >> Before it was working with chrome, suddently it stopped. 
> >> 
> >> On Friday, October 5, 2012 7:32:16 PM UTC+2, Larry@gmail.comwrote: 
> >>> 
> >>> On Fri, Oct 5, 2012 at 10:57 AM, Stefano T 
> >>>  wrote: 
> >>> > Hi all. 
> >>> > i'm new to django and i'm facing a problem i can't solve so far. 
> >>> > Basically, when i log in in the admin part, every operation i do it 
> >>> > ask me for the login. doesn't matter which browser i user, it's 
> always 
> >>> > the same. 
> >>> > at the beginning it was acting normally: once logged in i stay 
> logged 
> >>> > in until the logout. 
> >>> > idea? 
> >>> 
> >>> What is SESSION_COOKIE_AGE set to in your settings file? Or are 
> >>> cookies disabled for your browser? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/django-users/-/jJ7LrE2_TC0J. 
> > 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Qj_oADXTnvIJ.
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.