#34787: The 'runserver' command doesn't work when run from an installed script 
on
Windows
-------------------------------------+-------------------------------------
     Reporter:  Joël Larose          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Management     |                  Version:  4.2
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Joël Larose):

 * status:  closed => new
 * resolution:  needsinfo =>


Comment:

 There's no stack trace produced.  I even tried wrapping my code in try-
 catch block, and it doesn't trap anything.  I had to import pdb and trace
 it to discover where the problem lies.


 == Execution with the original code
 Using the `exe`:
 {{{
 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django> djm
 runserver
 C:\Users\jplarose\Projects\green-rosewood\art-
 django\venv\Scripts\python.exe: Error while finding module specification
 for '__main__' (ValueError: __main__.__spec__ is None)
 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django>
 }}}

 Using `python ...py`:
 {{{
 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django> python
 .\greenrosewood_art\manage.py runserver
 Watching for file changes with StatReloader
 Performing system checks...

 System check identified no issues (0 silenced).
 August 21, 2023 - 00:11:37
 Django version 4.2.4, using settings 'greenrosewood_art.site.settings.dev'
 Starting development server at http://127.0.0.1:8000/
 Quit the server with CTRL-BREAK.

 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django>
 }}}

 Using `python -m`:
 {{{
 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django> python -m
 greenrosewood_art.manage runserver
 Watching for file changes with StatReloader
 Performing system checks...

 System check identified no issues (0 silenced).
 August 21, 2023 - 00:14:36
 Django version 4.2.4, using settings 'greenrosewood_art.site.settings.dev'
 Starting development server at http://127.0.0.1:8000/
 Quit the server with CTRL-BREAK.

 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django>
 }}}

 == Execution with fixed code (i.e. `if` blocks flipped):

 Using the `exe`:
 {{{
 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django> djm
 runserver
 Watching for file changes with StatReloader
 Performing system checks...

 System check identified no issues (0 silenced).
 August 21, 2023 - 00:17:46
 Django version 4.2.4, using settings 'greenrosewood_art.site.settings.dev'
 Starting development server at http://127.0.0.1:8000/
 Quit the server with CTRL-BREAK.

 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django>
 }}}
 Using `python ...py`:
 {{{
 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django> python
 .\greenrosewood_art\manage.py runserver
 Watching for file changes with StatReloader
 Performing system checks...

 System check identified no issues (0 silenced).
 August 21, 2023 - 00:19:58
 Django version 4.2.4, using settings 'greenrosewood_art.site.settings.dev'
 Starting development server at http://127.0.0.1:8000/
 Quit the server with CTRL-BREAK.

 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django>
 }}}

 Using `python -m`:
 {{{
 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django> python -m
 greenrosewood_art.manage runserver
 Watching for file changes with StatReloader
 Performing system checks...

 System check identified no issues (0 silenced).
 August 21, 2023 - 00:19:09
 Django version 4.2.4, using settings 'greenrosewood_art.site.settings.dev'
 Starting development server at http://127.0.0.1:8000/
 Quit the server with CTRL-BREAK.

 (venv) PS C:\Users\jplarose\Projects\green-rosewood\art-django>
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34787#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018a1653d218-8a0a0974-80a0-4784-bb89-d8a037c00bd9-000000%40eu-central-1.amazonses.com.

Reply via email to