Re: Improvements to the startproject template

2022-04-20 Thread John M

I do exactly this for every new Django project, so it's +1 from me as well.

John

On 20/04/2022 12:01, da...@springbourne-tech.com wrote:

+1 for me - this would be really useful.

On Monday, April 18, 2022 at 9:02:02 PM UTC+1 pyt...@ian.feete.org wrote:

Hi Tim,

This feels like a good idea to me.

Regards,
Ian

On Mon, 18 Apr 2022 at 18:17, Tim Allen
 wrote:

Greetings, friends!

I've issued a PR that makes two changes to the
`startproject` template:

  * instead of putting configuration files such
as `settings.py`, `wsgi.py`, and the
root `urls.py` in `my_project/my_project`, they are
created in `my_project/config`
  * start the project with a custom User model app, `users`

Over the years, I've taught or tutored over 100 Djangonauts
starting their first project. Having to distinguish between
two directories with the same name is a constant pain point in
the teaching process - "cd into my_project ... no, the other one!"

  * The `config` option seemed to be the consensus from this
thread in the forum: Django New Project Structure/Name -
Using Django - Django Forum (djangoproject.com)


  * Ticket: https://github.com/django/django/pull/15609

It is sometimes better to show rather than tell, so following
our own documentation and including a custom User model with
the initial project template reinforces the best practice that
we explicitly point out in the documentation.

  * Ticket: #27909 (Use AUTH_USER_MODEL in startproject
template) – Django (djangoproject.com)

  * Avoids ever having this come up again:

https://www.caktusgroup.com/blog/2019/04/26/how-switch-custom-django-user-model-mid-project/

Here's a link to the PR:
https://github.com/django/django/pull/15609

My apologies for not starting with a discussion first. I'm an
infrequent contributor to the Django codebase!

Regards,

Tim

-- 
You received this message because you are subscribed to the

Google Groups "Django developers (Contributions to Django
itself)" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-developers/33cb49d0-2469-47c0-920e-9501245c5a27n%40googlegroups.com

.

--
You received this message because you are subscribed to the Google 
Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a184bfc1-e3fb-4bd7-8378-292194e52595n%40googlegroups.com 
.


--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ffb8a027-d5c7-53b4-1ea7-c9f687b8c80d%40martinhome.org.uk.


Debugging Django

2007-11-09 Thread John M. Anderson
I'm trying to debug sql.py

the steps I've taken so far:

python /usr/lib/python2.5/pdb.py manage.py sql polls
(python manage.py polls works just fine)
(Pdb) b django/core/management/sql.py:271
(Pdb) c


Traceback (most recent call last):
  File "/usr/lib/python2.5/pdb.py", line 1213, in main
pdb._runscript(mainpyfile)
  File "/usr/lib/python2.5/pdb.py", line 1138, in _runscript
self.run(statement, globals=globals_, locals=locals_)
  File "/usr/lib/python2.5/bdb.py", line 366, in run
exec cmd in globals, locals
  File "", line 1, in 
  File "./manage.py", line 11, in 
execute_manager(settings)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/__init__.py",
line 275, in execute_manager
project_directory = setup_environ(settings_mod)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/__init__.py",
line 255, in setup_environ
project_module = __import__(project_name, {}, {}, [''])
ValueError: Empty module name
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
>
/usr/local/lib/python2.5/site-packages/django/core/management/__init__.py(255)setup_environ()
-> project_module = __import__(project_name, {}, {}, [''])


What module name is invalid?   does pdb change the way my environment works?

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



Re: Debugging Django

2007-11-09 Thread John M. Anderson
> You cannot debug a single Django file in isolation. Instead, insert this
> line:
>
>import pdb; pdb.set_trace()
>
> in sql.py, at the point you're interested in. Then run Django normally,
> and
> go to a db-based URL: you'll get a debugger prompt.
>

ok, thanks. I was just trying to debug without modifying files, it seems
silly
to have to modify the files to debug, but i'm new to python.

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