OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

"manage.py runserver" now does not run with "py", only "python" overnight

  • Thread starter Thread starter dkovelie
  • Start date Start date
D

dkovelie

Guest
Beginning with web development, using VSCode, Python 3.12.3 in a virtual environment, and Django 5.0.6.

When running:

Code:
py manage.py runserver

I get:

Code:
Unable to create process using 'c:\Users\MyUserName\Documents\GitHub\Coding Practice\Python\DjangoLearningMongo\.venv\Scripts\python.exe manage.py runserver'

Another post suggested using just manage.py runserver, but that yields:

Code:
Unable to create process using 'c:\Users\MyUserName\Documents\GitHub\Coding Practice\Python\DjangoLearningMongo\.venv\Scripts\python.exe "C:\Users\MyUserName\Documents\GitHub\Coding Practice\Python\DjangoLearningMongo\grocery_prices_mongo\manage.py"  runserver'

I have used py manage.py runserver for the entirety of the project just fine until this morning. Now, py fails to work with anything, yielding the above, and instead I must use python.

These are the changes I made to the project yesterday:

  • added static files to the project (static folder, settings.py to have STATIC_ROOT, py manage.py collectstatic, etc...)
  • pip installed whitenoise to handle static CSS in production
  • set DEBUG to FALSE
  • Added 127.0.0.1 to ALLOWED_HOSTS

I was still able to use py manage.py runserver (or other py manage.py commands) each step of the way as I made these changes, it was only this morning when I returned to the project that py stopped working and had to use python instead, which I had not needed to do at any point prior in the project.

I even went to another project I have not run or edited in a week or so and it gets the same error when using py, even though its venv is on a different version of Python than the project I first encountered the error with.

When I made a brand new Django project, it worked using py, both within and outside of a virtual environment.

I have tried:

  • deactivating and reactivating the virtual environment
  • upgrading pip
  • removing and remaking the virtual environment
  • repairing the Python installation the venv used when creating the venv
  • removing and remaking the virtual environment again after repairing the installation
  • restoring the project to a version from before the recent changes

Each step would yield the same result for the project -- py failed to work with the same error, while python would work.

In the process, I did find that py and python point to different Python versions when used outside of a virtual environment (3.12.3 and 3.10.4, respectively). However, despite this, py would get the same error on both the 3.12.3 venv project and the 3.10.4 venv project, while python would work for both.

I checked my PATH environmental variables, and they are unchanged.

What could have induced this change, and how can I get the original functionality for py back?
<p>Beginning with web development, using VSCode, Python 3.12.3 in a virtual environment, and Django 5.0.6.</p>
<p>When running:</p>
<pre><code>py manage.py runserver
</code></pre>
<p>I get:</p>
<pre><code>Unable to create process using 'c:\Users\MyUserName\Documents\GitHub\Coding Practice\Python\DjangoLearningMongo\.venv\Scripts\python.exe manage.py runserver'
</code></pre>
<p>Another post suggested using just <code>manage.py runserver</code>, but that yields:</p>
<pre><code>Unable to create process using 'c:\Users\MyUserName\Documents\GitHub\Coding Practice\Python\DjangoLearningMongo\.venv\Scripts\python.exe "C:\Users\MyUserName\Documents\GitHub\Coding Practice\Python\DjangoLearningMongo\grocery_prices_mongo\manage.py" runserver'
</code></pre>
<p>I have used <code>py manage.py runserver</code> for the entirety of the project just fine until this morning. Now, <code>py</code> fails to work with anything, yielding the above, and instead I must use <code>python</code>.</p>
<p>These are the changes I made to the project yesterday:</p>
<ul>
<li>added static files to the project (static folder, settings.py to have STATIC_ROOT, py manage.py collectstatic, etc...)</li>
<li>pip installed whitenoise to handle static CSS in production</li>
<li>set <code>DEBUG</code> to <code>FALSE</code></li>
<li>Added 127.0.0.1 to <code>ALLOWED_HOSTS</code></li>
</ul>
<p>I was still able to use <code>py manage.py runserver</code> (or other <code>py manage.py</code> commands) each step of the way as I made these changes, it was only this morning when I returned to the project that <code>py</code> stopped working and had to use <code>python</code> instead, which I had not needed to do at any point prior in the project.</p>
<p>I even went to another project I have not run or edited in a week or so and it gets the same error when using <code>py</code>, even though its venv is on a different version of Python than the project I first encountered the error with.</p>
<p>When I made a brand new Django project, it worked using <code>py</code>, both within and outside of a virtual environment.</p>
<p>I have tried:</p>
<ul>
<li>deactivating and reactivating the virtual environment</li>
<li>upgrading pip</li>
<li>removing and remaking the virtual environment</li>
<li>repairing the Python installation the venv used when creating the venv</li>
<li>removing and remaking the virtual environment again after repairing the installation</li>
<li>restoring the project to a version from before the recent changes</li>
</ul>
<p>Each step would yield the same result for the project -- <code>py</code> failed to work with the same error, while <code>python</code> would work.</p>
<p>In the process, I did find that <code>py</code> and <code>python</code> point to different Python versions when used outside of a virtual environment (3.12.3 and 3.10.4, respectively). However, despite this, <code>py</code> would get the same error on both the 3.12.3 venv project and the 3.10.4 venv project, while <code>python</code> would work for both.</p>
<p>I checked my <code>PATH</code> environmental variables, and they are unchanged.</p>
<p>What could have induced this change, and how can I get the original functionality for <code>py</code> back?</p>
 

Latest posts

Top