Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-28 Thread 'Peter Müller' via Django users
I do not think that

"Each view is responsible for doing one of two things: Returning an 
> HttpResponse object containing the content for the requested page, or 
> raising an exception such as Http404. The rest is up to you." 
>

is easy for a beginner to understand. Also the tutorial directly asks me to 
copy and paste the code. And I think everybody agrees that copy pasting is 
teaching almost nothing of value.
 I think an explanation like:

A view processes a request and returns a Response such as a webpage.

is much rather fitting. Also the explanation should be given while the 
first view is written.
However I still get what the tutorial is trying to achieve:
To create a working project and then explain afterwards what each part does.
But then why not deliver a zip-file with all code already written?


As a matter of fact it is easier to use Class based views usually, so 
> calling render explicitly is not that common, but function based views 
> are easier to understand initially. 
>

I agree that this is the case. However my point is that the tutorial should 
not show* every possible way* to make a view.
Rather than just *one way* and stick to it.


To make my argument more short and concise:
The tutorial lacks simplicity and tries to show *everything you could 
possibly imagine* doing with django while not managing to transmit the most 
basic usage.



Am Samstag, 28. Januar 2017 16:31:04 UTC+1 schrieb Vijay Khemlani:
>
> > A quick one is e.g. that there is no explanation of what a view is and 
> what 
> > 
> > its purpose is. 
>
> "The code above maps URLs, as simple regular expressions, to the 
> location of Python callback functions (“views”)" 
>
> "Each view is responsible for doing one of two things: Returning an 
> HttpResponse object containing the content for the requested page, or 
> raising an exception such as Http404. The rest is up to you." 
>
> > For a beginner it would be much more easy to simply user render() from 
> the 
> > beginning on and later show cases where render() is not sufficient to do 
> > the job. 
>
> As a matter of fact it is easier to use Class based views usually, so 
> calling render explicitly is not that common, but function based views 
> are easier to understand initially. 
>
> > If I could I would gladly rewrite the tutorial. But sadly I do not have 
> > enough time to do so. 
>
> Maybe... it's a good thing you don't have time really 
>
> On 1/28/17, 'Peter Müller' via Django users 
>  wrote: 
> > 
> > If I could I would gladly rewrite the tutorial. But sadly I do not have 
> > enough time to do so. 
> > However I think it is bad since it not only completely disregards the 
> zen 
> > of py but also its own principles (DRY etc.) If you need concrete 
> examples 
> > I can name you tons. 
> > A quick one is e.g. that there is no explanation of what a view is and 
> what 
> > 
> > its purpose is. 
> > Also there is literally in part three: "But, don’t do that. It’s 
> silly.". 
> > If I should not do it then do not mention in a beginners tutorial… 
> > Another example here is the "shortcut" render() function. It is a 
> beginners 
> > 
> > tutorial so I do not expect an in-depth explanation of any way possible 
> but 
> > 
> > only the easiest one. 
> > For a beginner it would be much more easy to simply user render() from 
> the 
> > beginning on and later show cases where render() is not sufficient to do 
> > the job. 
> > By far the best tutorial I yet had was of pygame. One well documented 
> > example and the docs were enough to teach me how it works. 
> > 
> > On a side-note (this is only personal preference): 
> > I do not like that the tutorial is part of the documentation. 
> > A tutorial should never be a documentation. A documentation should 
> capture 
> > anything you can do with the framework. 
> > However a tutorial should only show you one way (and also the easiest) 
> of 
> > doing of one certain task. 
> > 
> > Am Freitag, 27. Januar 2017 20:50:39 UTC+1 schrieb Melvyn Sopacua: 
> >> 
> >> https://github.com/django/django/pulls 
> >> 
> >> 
> >> 
> >> The tutorial has a very logical order, going from the database 
> abstraction 
> >> 
> >> up to the template layer and beyond. But feel free to rewrite it and 
> >> submit 
> >> it to the project. 
> >> 
> >> 
> >> 
> >> I never follow tutorials to the letter - for example back when I did it 
> in 
> >> 
> >> Django 1.3, my polls app had an ip-based rate limiter tucked onto 
> existing 
> >> 
> >> code - but it certainly is one of the top tutorials for a framework 
> I've 
> >> seen. 
> >> 
> >> 
> >> 
> >> On Friday 27 January 2017 10:27:46 'Peter Müller' via Django users 
> wrote: 
> >> 
> >> > What do you mean by PR? 
> >> 
> >> > 
> >> 
> >> > Am Freitag, 27. Januar 2017 18:32:23 UTC+1 schrieb Melvyn Sopacua: 
> >> 
> >> > > On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users 
> >> wrote: 
> >> 
> >> > > > Also I used the tutorial just that I 

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-28 Thread Vijay Khemlani
> A quick one is e.g. that there is no explanation of what a view is and what
>
> its purpose is.

"The code above maps URLs, as simple regular expressions, to the
location of Python callback functions (“views”)"

"Each view is responsible for doing one of two things: Returning an
HttpResponse object containing the content for the requested page, or
raising an exception such as Http404. The rest is up to you."

> For a beginner it would be much more easy to simply user render() from the
> beginning on and later show cases where render() is not sufficient to do
> the job.

As a matter of fact it is easier to use Class based views usually, so
calling render explicitly is not that common, but function based views
are easier to understand initially.

> If I could I would gladly rewrite the tutorial. But sadly I do not have
> enough time to do so.

Maybe... it's a good thing you don't have time really

On 1/28/17, 'Peter Müller' via Django users
 wrote:
>
> If I could I would gladly rewrite the tutorial. But sadly I do not have
> enough time to do so.
> However I think it is bad since it not only completely disregards the zen
> of py but also its own principles (DRY etc.) If you need concrete examples
> I can name you tons.
> A quick one is e.g. that there is no explanation of what a view is and what
>
> its purpose is.
> Also there is literally in part three: "But, don’t do that. It’s silly.".
> If I should not do it then do not mention in a beginners tutorial…
> Another example here is the "shortcut" render() function. It is a beginners
>
> tutorial so I do not expect an in-depth explanation of any way possible but
>
> only the easiest one.
> For a beginner it would be much more easy to simply user render() from the
> beginning on and later show cases where render() is not sufficient to do
> the job.
> By far the best tutorial I yet had was of pygame. One well documented
> example and the docs were enough to teach me how it works.
>
> On a side-note (this is only personal preference):
> I do not like that the tutorial is part of the documentation.
> A tutorial should never be a documentation. A documentation should capture
> anything you can do with the framework.
> However a tutorial should only show you one way (and also the easiest) of
> doing of one certain task.
>
> Am Freitag, 27. Januar 2017 20:50:39 UTC+1 schrieb Melvyn Sopacua:
>>
>> https://github.com/django/django/pulls
>>
>>
>>
>> The tutorial has a very logical order, going from the database abstraction
>>
>> up to the template layer and beyond. But feel free to rewrite it and
>> submit
>> it to the project.
>>
>>
>>
>> I never follow tutorials to the letter - for example back when I did it in
>>
>> Django 1.3, my polls app had an ip-based rate limiter tucked onto existing
>>
>> code - but it certainly is one of the top tutorials for a framework I've
>> seen.
>>
>>
>>
>> On Friday 27 January 2017 10:27:46 'Peter Müller' via Django users wrote:
>>
>> > What do you mean by PR?
>>
>> >
>>
>> > Am Freitag, 27. Januar 2017 18:32:23 UTC+1 schrieb Melvyn Sopacua:
>>
>> > > On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users
>> wrote:
>>
>> > > > Also I used the tutorial just that I abstracted the concept since
>>
>> > > > I
>>
>> > > >
>>
>> > > > think the tutorial is more than bad.
>>
>> > >
>>
>> > > Awaiting your PRs.
>>
>> > >
>>
>> > >
>>
>> > > Melvyn Sopacua
>>
>>
>>
>> --
>>
>> Melvyn Sopacua
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6c24f788-7a60-4118-96d7-58c52376bb30%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0_8Pi2ZC0KJ5U70DpZpuR145TMVqkgW52ce6Sga%2BXZAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-28 Thread 'Peter Müller' via Django users

If I could I would gladly rewrite the tutorial. But sadly I do not have 
enough time to do so.
However I think it is bad since it not only completely disregards the zen 
of py but also its own principles (DRY etc.) If you need concrete examples 
I can name you tons.
A quick one is e.g. that there is no explanation of what a view is and what 
its purpose is.
Also there is literally in part three: "But, don’t do that. It’s silly.". 
If I should not do it then do not mention in a beginners tutorial…
Another example here is the "shortcut" render() function. It is a beginners 
tutorial so I do not expect an in-depth explanation of any way possible but 
only the easiest one.
For a beginner it would be much more easy to simply user render() from the 
beginning on and later show cases where render() is not sufficient to do 
the job.
By far the best tutorial I yet had was of pygame. One well documented 
example and the docs were enough to teach me how it works.

On a side-note (this is only personal preference):
I do not like that the tutorial is part of the documentation.
A tutorial should never be a documentation. A documentation should capture 
anything you can do with the framework.
However a tutorial should only show you one way (and also the easiest) of 
doing of one certain task.

Am Freitag, 27. Januar 2017 20:50:39 UTC+1 schrieb Melvyn Sopacua:
>
> https://github.com/django/django/pulls
>
>  
>
> The tutorial has a very logical order, going from the database abstraction 
> up to the template layer and beyond. But feel free to rewrite it and submit 
> it to the project.
>
>  
>
> I never follow tutorials to the letter - for example back when I did it in 
> Django 1.3, my polls app had an ip-based rate limiter tucked onto existing 
> code - but it certainly is one of the top tutorials for a framework I've 
> seen.
>
>  
>
> On Friday 27 January 2017 10:27:46 'Peter Müller' via Django users wrote:
>
> > What do you mean by PR?
>
> > 
>
> > Am Freitag, 27. Januar 2017 18:32:23 UTC+1 schrieb Melvyn Sopacua:
>
> > > On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users 
> wrote:
>
> > > > Also I used the tutorial just that I abstracted the concept since
>
> > > > I
>
> > > > 
>
> > > > think the tutorial is more than bad.
>
> > > 
>
> > > Awaiting your PRs.
>
> > > 
>
> > > 
>
> > > Melvyn Sopacua
>
>  
>
> -- 
>
> Melvyn Sopacua
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6c24f788-7a60-4118-96d7-58c52376bb30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-27 Thread Melvyn Sopacua
https://github.com/django/django/pulls

The tutorial has a very logical order, going from the database abstraction up 
to the 
template layer and beyond. But feel free to rewrite it and submit it to the 
project.

I never follow tutorials to the letter - for example back when I did it in 
Django 1.3, my 
polls app had an ip-based rate limiter tucked onto existing code - but it 
certainly is one 
of the top tutorials for a framework I've seen.

On Friday 27 January 2017 10:27:46 'Peter Müller' via Django users wrote:
> What do you mean by PR?
> 
> Am Freitag, 27. Januar 2017 18:32:23 UTC+1 schrieb Melvyn Sopacua:
> > On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users wrote:
> > > Also I used the tutorial just that I abstracted the concept since
> > > I
> > > 
> > > think the tutorial is more than bad.
> > 
> > Awaiting your PRs.
> > 
> > 
> > Melvyn Sopacua

-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1965514.Xgg9TXGu1a%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-27 Thread 'Peter Müller' via Django users
What do you mean by PR?

Am Freitag, 27. Januar 2017 18:32:23 UTC+1 schrieb Melvyn Sopacua:
>
> On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users wrote:
>
>  
>
> > Also I used the tutorial just that I abstracted the concept since I
>
> > think the tutorial is more than bad.
>
>  
>
> Awaiting your PRs.
>
> -- 
>
> Melvyn Sopacua
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bd14d94f-026d-4ea4-816c-83be35b5d37f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-27 Thread Melvyn Sopacua
On Monday 16 January 2017 07:49:00 'Peter Müller' via 
Django users wrote:

> Also I used the tutorial just that I abstracted the 
concept since I
> think the tutorial is more than bad.

Awaiting your PRs.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3266032.9fPFhc9bEY%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-27 Thread 'Peter Müller' via Django users
But if I do a direct import via python's import statement. it will execute 
the content of the file before loading apps and that raises that error.
No matter what you import you *have* to use django's import system. Also it 
just works fine now.

Am Dienstag, 17. Januar 2017 23:05:10 UTC+1 schrieb Vijay Khemlani:
>
> The only "custom include" in Django is for loading other url files 
>
> The rest of the imports are typical Python module / packages 
>
> On 1/17/17, 'Peter Müller' via Django users 
>  wrote: 
> > Ah I now see the problem. However I tried to remove the entry in the 
> > __init__.py file 
> > Python is then unable to find *any *module in that directory. Don't ask 
> me 
> > why that is. 
> > 
> > Also I noticed that django has its completely own import ecosystem. 
> > So I used django.conf.urls.include to include a new urls file in that 
> sub 
> > directory. 
> > And suddenly everything works fine. 
> > 
> > Thanks everyone 
> > 
> > Am Dienstag, 17. Januar 2017 08:01:41 UTC+1 schrieb Michal Petrucha: 
> >> 
> >> On Mon, Jan 16, 2017 at 12:23:09PM -0800, 'Peter Müller' via Django 
> users 
> >> 
> >> wrote: 
> >> > Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman: 
> >> > > The traceback shows that you are importing your views module in the 
> >> > > __init__.py of your app. Don't do that. 
> >> > 
> >> > Well else python doesn't find the view.py file? 
> >> 
> >> Python will be able to import db_testing.views just fine even if you 
> >> don't import viewsi from . in db_testing/__init__.py. All Python cares 
> >> about is that there is a correct Python file in the correct location. 
> >> 
> >> If you're interested in more details about what's going wrong here, 
> >> there's an explanation here: 
> >> 
> >> 
> https://docs.djangoproject.com/en/1.10/ref/applications/#how-applications-are-loaded
>  
> >> 
> >> 
> >> In particular, the following paragraphs: 
> >> 
> >> > At this stage, your code shouldn’t import any models! 
> >> > 
> >> > In other words, your applications’ root packages and the modules 
> >> > that define your application configuration classes shouldn’t import 
> >> > any models, even indirectly. 
> >> 
> >> What's happening here is that the root of your “db_testing” package 
> >> (i.e. db_testing/__init__.py) indirectly imports models, because it 
> >> imports the views module, which in turn imports models. 
> >> 
> >> Just removing the “from . import views” line should let you move 
> >> forward – unless you also have other imports in the __init__.py file, 
> >> in which case you can most likely just remove them, too. In general, 
> >> in an average Django package, there's little reason to import stuff in 
> >> its root package. 
> >> 
> >> Good luck, 
> >> 
> >> Michal 
> >> 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/b1760656-c6a0-40c5-a002-19958e5706ef%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6d45b367-bed9-4181-80c0-d07b82d35df3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-17 Thread Vijay Khemlani
The only "custom include" in Django is for loading other url files

The rest of the imports are typical Python module / packages

On 1/17/17, 'Peter Müller' via Django users
 wrote:
> Ah I now see the problem. However I tried to remove the entry in the
> __init__.py file
> Python is then unable to find *any *module in that directory. Don't ask me
> why that is.
>
> Also I noticed that django has its completely own import ecosystem.
> So I used django.conf.urls.include to include a new urls file in that sub
> directory.
> And suddenly everything works fine.
>
> Thanks everyone
>
> Am Dienstag, 17. Januar 2017 08:01:41 UTC+1 schrieb Michal Petrucha:
>>
>> On Mon, Jan 16, 2017 at 12:23:09PM -0800, 'Peter Müller' via Django users
>>
>> wrote:
>> > Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman:
>> > > The traceback shows that you are importing your views module in the
>> > > __init__.py of your app. Don't do that.
>> >
>> > Well else python doesn't find the view.py file?
>>
>> Python will be able to import db_testing.views just fine even if you
>> don't import viewsi from . in db_testing/__init__.py. All Python cares
>> about is that there is a correct Python file in the correct location.
>>
>> If you're interested in more details about what's going wrong here,
>> there's an explanation here:
>>
>> https://docs.djangoproject.com/en/1.10/ref/applications/#how-applications-are-loaded
>>
>>
>> In particular, the following paragraphs:
>>
>> > At this stage, your code shouldn’t import any models!
>> >
>> > In other words, your applications’ root packages and the modules
>> > that define your application configuration classes shouldn’t import
>> > any models, even indirectly.
>>
>> What's happening here is that the root of your “db_testing” package
>> (i.e. db_testing/__init__.py) indirectly imports models, because it
>> imports the views module, which in turn imports models.
>>
>> Just removing the “from . import views” line should let you move
>> forward – unless you also have other imports in the __init__.py file,
>> in which case you can most likely just remove them, too. In general,
>> in an average Django package, there's little reason to import stuff in
>> its root package.
>>
>> Good luck,
>>
>> Michal
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b1760656-c6a0-40c5-a002-19958e5706ef%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3UOv%2BeiT6eRbZqSnmaNadbc-Smwfc%2BCK0%3DMuxC2opTCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-17 Thread 'Peter Müller' via Django users
Ah I now see the problem. However I tried to remove the entry in the 
__init__.py file
Python is then unable to find *any *module in that directory. Don't ask me 
why that is.

Also I noticed that django has its completely own import ecosystem.
So I used django.conf.urls.include to include a new urls file in that sub 
directory.
And suddenly everything works fine.

Thanks everyone 

Am Dienstag, 17. Januar 2017 08:01:41 UTC+1 schrieb Michal Petrucha:
>
> On Mon, Jan 16, 2017 at 12:23:09PM -0800, 'Peter Müller' via Django users 
> wrote: 
> > Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman: 
> > > The traceback shows that you are importing your views module in the 
> > > __init__.py of your app. Don't do that. 
> > 
> > Well else python doesn't find the view.py file? 
>
> Python will be able to import db_testing.views just fine even if you 
> don't import viewsi from . in db_testing/__init__.py. All Python cares 
> about is that there is a correct Python file in the correct location. 
>
> If you're interested in more details about what's going wrong here, 
> there's an explanation here: 
>
> https://docs.djangoproject.com/en/1.10/ref/applications/#how-applications-are-loaded
>  
>
> In particular, the following paragraphs: 
>
> > At this stage, your code shouldn’t import any models! 
> > 
> > In other words, your applications’ root packages and the modules 
> > that define your application configuration classes shouldn’t import 
> > any models, even indirectly. 
>
> What's happening here is that the root of your “db_testing” package 
> (i.e. db_testing/__init__.py) indirectly imports models, because it 
> imports the views module, which in turn imports models. 
>
> Just removing the “from . import views” line should let you move 
> forward – unless you also have other imports in the __init__.py file, 
> in which case you can most likely just remove them, too. In general, 
> in an average Django package, there's little reason to import stuff in 
> its root package. 
>
> Good luck, 
>
> Michal 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b1760656-c6a0-40c5-a002-19958e5706ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Michal Petrucha
On Mon, Jan 16, 2017 at 12:23:09PM -0800, 'Peter Müller' via Django users wrote:
> Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman:
> > The traceback shows that you are importing your views module in the 
> > __init__.py of your app. Don't do that. 
> 
> Well else python doesn't find the view.py file?

Python will be able to import db_testing.views just fine even if you
don't import viewsi from . in db_testing/__init__.py. All Python cares
about is that there is a correct Python file in the correct location.

If you're interested in more details about what's going wrong here,
there's an explanation here:
https://docs.djangoproject.com/en/1.10/ref/applications/#how-applications-are-loaded

In particular, the following paragraphs:

> At this stage, your code shouldn’t import any models!
>
> In other words, your applications’ root packages and the modules
> that define your application configuration classes shouldn’t import
> any models, even indirectly.

What's happening here is that the root of your “db_testing” package
(i.e. db_testing/__init__.py) indirectly imports models, because it
imports the views module, which in turn imports models.

Just removing the “from . import views” line should let you move
forward – unless you also have other imports in the __init__.py file,
in which case you can most likely just remove them, too. In general,
in an average Django package, there's little reason to import stuff in
its root package.

Good luck,

Michal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20170117070025.GN1628%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread 'Peter Müller' via Django users
Yes

Am Montag, 16. Januar 2017 22:33:57 UTC+1 schrieb Matthew Pava:
>
> You import views in your urls.py file.  Your settings.py file has a 
> constant pointing to where the urls.py file is located for the project.  
> Your urls.py file is the one that actually utilizes the views file.
>
>  
>
> *From:* 'Peter Müller' via Django users [mailto:django...@googlegroups.com 
> ] 
> *Sent:* Monday, January 16, 2017 2:23 PM
> *To:* Django users
> *Subject:* Re: Am I stupid or is there an essential error in Django 1.10 
> Docs?
>
>  
>
> Well else python doesn't find the view.py file?
>
> Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman:
>
> On Monday, 16 January 2017 15:53:56 UTC, Peter Müller wrote:
>
> For the traceback: http://pastebin.com/Wy7And6M
> And the views configuration: http://pastebin.com/q0V3bQay
>
>
> thanks
>
> Peter
>
>  
>
>  
>
> The traceback shows that you are importing your views module in the 
> __init__.py of your app. Don't do that. 
>
> -- 
>
> DR.
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to djang...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/d615e2de-e205-4536-bc08-771e62b59e0a%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/d615e2de-e205-4536-bc08-771e62b59e0a%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e9387b4b-0f96-4bed-b5d7-89aae11c880a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Matthew Pava
You import views in your urls.py file.  Your settings.py file has a constant 
pointing to where the urls.py file is located for the project.  Your urls.py 
file is the one that actually utilizes the views file.

From: 'Peter Müller' via Django users [mailto:django-users@googlegroups.com]
Sent: Monday, January 16, 2017 2:23 PM
To: Django users
Subject: Re: Am I stupid or is there an essential error in Django 1.10 Docs?

Well else python doesn't find the view.py file?

Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman:
On Monday, 16 January 2017 15:53:56 UTC, Peter Müller wrote:
For the traceback: http://pastebin.com/Wy7And6M
And the views configuration: http://pastebin.com/q0V3bQay


thanks

Peter


The traceback shows that you are importing your views module in the __init__.py 
of your app. Don't do that.
--
DR.
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d615e2de-e205-4536-bc08-771e62b59e0a%40googlegroups.com<https://groups.google.com/d/msgid/django-users/d615e2de-e205-4536-bc08-771e62b59e0a%40googlegroups.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/700a3205cc4e4531b259a402f3112838%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread 'Peter Müller' via Django users
Stranvr ist the project made with startproject and db_testing is an app 
made with startapp.

So:
ProjectRoot
-StranvrProject
--urls.py
--settings.py
--wsgi.py
-db_testing
--views.py
--__init__.py
--models.py
--admin.py
--apps.py


also the app is added to settings.py

Am Montag, 16. Januar 2017 22:24:30 UTC+1 schrieb Andréas Kühne:
>
> What does the project structure look like?
>
> Is Stranvr the name of the project?
>
> It looks to me like you haven't created an app - or have you called your 
> app "db_testing" and the project "Stranvr"?
>
> Because you first have to create you project with "django-admin.py 
> startproject " and then within that created directory run 
> either "./manage.py startapp " or "django-admin.py startapp 
> ".
>
> Regards,
>
> Andréas
>
> 2017-01-16 21:23 GMT+01:00 'Peter Müller' via Django users <
> django...@googlegroups.com >:
>
>> Well else python doesn't find the view.py file?
>>
>> Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman:
>>>
>>> On Monday, 16 January 2017 15:53:56 UTC, Peter Müller wrote:

 For the traceback: http://pastebin.com/Wy7And6M
 And the views configuration: http://pastebin.com/q0V3bQay


 thanks

 Peter

>>>
>>>
>>> The traceback shows that you are importing your views module in the 
>>> __init__.py of your app. Don't do that. 
>>> -- 
>>> DR.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d615e2de-e205-4536-bc08-771e62b59e0a%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92ee79d1-faf1-41d1-89ee-e2dc213f60b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Andreas Kuhne
What does the project structure look like?

Is Stranvr the name of the project?

It looks to me like you haven't created an app - or have you called your
app "db_testing" and the project "Stranvr"?

Because you first have to create you project with "django-admin.py
startproject " and then within that created directory run
either "./manage.py startapp " or "django-admin.py startapp
".

Regards,

Andréas

2017-01-16 21:23 GMT+01:00 'Peter Müller' via Django users <
django-users@googlegroups.com>:

> Well else python doesn't find the view.py file?
>
> Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman:
>>
>> On Monday, 16 January 2017 15:53:56 UTC, Peter Müller wrote:
>>>
>>> For the traceback: http://pastebin.com/Wy7And6M
>>> And the views configuration: http://pastebin.com/q0V3bQay
>>>
>>>
>>> thanks
>>>
>>> Peter
>>>
>>
>>
>> The traceback shows that you are importing your views module in the
>> __init__.py of your app. Don't do that.
>> --
>> DR.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/d615e2de-e205-4536-bc08-771e62b59e0a%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbmBvnEbcd-xqULaMfAxtkbjb3uDBTW7kuTzCWbFNtiL9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread 'Peter Müller' via Django users
Well else python doesn't find the view.py file?

Am Montag, 16. Januar 2017 21:20:53 UTC+1 schrieb Daniel Roseman:
>
> On Monday, 16 January 2017 15:53:56 UTC, Peter Müller wrote:
>>
>> For the traceback: http://pastebin.com/Wy7And6M
>> And the views configuration: http://pastebin.com/q0V3bQay
>>
>>
>> thanks
>>
>> Peter
>>
>
>
> The traceback shows that you are importing your views module in the 
> __init__.py of your app. Don't do that. 
> -- 
> DR.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d615e2de-e205-4536-bc08-771e62b59e0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Daniel Roseman
On Monday, 16 January 2017 15:53:56 UTC, Peter Müller wrote:
>
> For the traceback: http://pastebin.com/Wy7And6M
> And the views configuration: http://pastebin.com/q0V3bQay
>
>
> thanks
>
> Peter
>


The traceback shows that you are importing your views module in the 
__init__.py of your app. Don't do that. 
-- 
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d87260a2-657d-4df6-917a-c36ee26b26ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread 'Peter Müller' via Django users
For the traceback: http://pastebin.com/Wy7And6M
And the views configuration: http://pastebin.com/q0V3bQay


thanks

Peter


Am Montag, 16. Januar 2017 15:53:42 UTC+1 schrieb Daniel Roseman:
>
> On Sunday, 15 January 2017 18:03:54 UTC, Peter Müller wrote:
>>
>> Hello everybody.
>>
>>
>> I just began learning how to use django. So I wanted to include data from 
>> the database in a testwebsite.
>> Therefore I made a new app and created a model called "user" and a view 
>> that should fill a template with data from that model.
>> To do this (according to Django 1.10 Docs/Tutorial) I need to import the 
>> model class into the view file and for example use models.user.all().
>> However on import of the view Django complains about 
>> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet
>>
>> What is the solution to that problem?
>>
>> Greetings
>> Peter
>>
>
> There is no possible way to answer this question without seeing the view 
> itself, and the full error traceback.
> -- 
> DR. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e6f438e6-4c35-41f4-9f67-654d6ad877f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread 'Peter Müller' via Django users
Thank you for your help. Even though I understand the obvious reason to use 
the in-built User model I prefer to make one myself.
Not because the integrated one is bad. It is just that it adds huge amounts 
of boilerplate and hidden django magic.
And since users are basically just a name and an identifier and present 
everywhere on the internet I chose to use them to learn how to interface 
DBs with Django.

Also I used the tutorial just that I abstracted the concept since I think 
the tutorial is more than bad.
In addition this method teaches on what essentially I am doing else then to 
blindly copying code.


Thanks

Peter

Am Sonntag, 15. Januar 2017 22:11:30 UTC+1 schrieb Mike Dewhirst:
>
> On 16/01/2017 5:01 AM, 'Peter Müller' via Django users wrote: 
> > Hello everybody. 
> > 
> > 
> > I just began learning how to use django. So I wanted to include data 
> > from the database in a testwebsite. 
> > Therefore I made a new app and created a model called "user" and 
>
> You don't need to create your own user model. There's one in the box ... 
>
> from django.contrib.auth.models import User 
>
> Try using that and see if your error goes away. Also, you should work 
> through the tutorial to get a handle on how it is used ... 
>
> https://docs.djangoproject.com/en/1.10/intro/tutorial01/ 
>
> As you are a Django beginner I assume you will try one or two small 
> projects before tackling a major one so just going with the standard 
> User model should be no impediment in the early stages. Then maybe look 
> through the docs to see how to customise/replace that User model. 
>
> Cheers 
>
> Mike 
>
> > a view that should fill a template with data from that model. 
> > To do this (according to Django 1.10 Docs/Tutorial) I need to import 
> > the model class into the view file and for example use 
> models.user.all(). 
> > However on import of the view Django complains about 
> > | 
> > django.core.exceptions.AppRegistryNotReady:Appsaren't loaded yet 
> > | 
> > 
> > What is the solution to that problem? 
> > 
> > Greetings 
> > Peter 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com  
> > . 
> > To post to this group, send email to django...@googlegroups.com 
>  
> > . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/31442c04-4da4-496b-8611-9d7b70e36138%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/31442c04-4da4-496b-8611-9d7b70e36138%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/442d8301-3521-40fc-9adc-9150ca0cfeab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Daniel Roseman
On Sunday, 15 January 2017 18:03:54 UTC, Peter Müller wrote:
>
> Hello everybody.
>
>
> I just began learning how to use django. So I wanted to include data from 
> the database in a testwebsite.
> Therefore I made a new app and created a model called "user" and a view 
> that should fill a template with data from that model.
> To do this (according to Django 1.10 Docs/Tutorial) I need to import the 
> model class into the view file and for example use models.user.all().
> However on import of the view Django complains about 
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet
>
> What is the solution to that problem?
>
> Greetings
> Peter
>

There is no possible way to answer this question without seeing the view 
itself, and the full error traceback.
-- 
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/556e003e-c90b-47f2-8d5d-7e96b58d6105%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-15 Thread Mike Dewhirst

On 16/01/2017 5:01 AM, 'Peter Müller' via Django users wrote:

Hello everybody.


I just began learning how to use django. So I wanted to include data 
from the database in a testwebsite.

Therefore I made a new app and created a model called "user" and


You don't need to create your own user model. There's one in the box ...

from django.contrib.auth.models import User

Try using that and see if your error goes away. Also, you should work 
through the tutorial to get a handle on how it is used ...


https://docs.djangoproject.com/en/1.10/intro/tutorial01/

As you are a Django beginner I assume you will try one or two small 
projects before tackling a major one so just going with the standard 
User model should be no impediment in the early stages. Then maybe look 
through the docs to see how to customise/replace that User model.


Cheers

Mike


a view that should fill a template with data from that model.
To do this (according to Django 1.10 Docs/Tutorial) I need to import 
the model class into the view file and for example use models.user.all().

However on import of the view Django complains about
|
django.core.exceptions.AppRegistryNotReady:Appsaren't loaded yet
|

What is the solution to that problem?

Greetings
Peter
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/31442c04-4da4-496b-8611-9d7b70e36138%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5257db09-88d7-c527-de9d-223b12299bde%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.