First time here? Check out the FAQ!
1

Cannot create Django Project on Windows

When trying to create a Django project on Windows, I get:

Expected django-admin does not exist: v:\bin\scripting\python\3.9.5\python-3.9.5.amd64\django-admin

I have a portable Python installation (winpython) which places the various package-specific executables/scripts under v:\bin\scripting\python\3.9.5\python-3.9.5.amd64\Scripts, also django-admin (seems to be standard to me). Up to now it was sufficient to include this directory in the path. But this does not work with Wings Django project setup.

Michael's avatar
171
Michael
asked 2021-10-27 17:43:00 -0600
Wingware Support's avatar
4k
Wingware Support
updated 2021-11-11 10:53:20 -0600
edit flag offensive 0 remove flag close merge delete

Comments

It looks like Wing looks for django-admin[.py] in the same directory as python.exe, which in the test installations I have is also in the Scripts dir. Is this different in portable Python?

Also, did you create a Python env or just use the base install? A possible work-around would be to create a pipenv from the second screen of the New Project dialog.

Wingware Support's avatar Wingware Support (2021-10-28 08:51:32 -0600) edit

For winpython, python.exe is one level up in v:\bin\scripting\python\3.9.5\python-3.9.5.amd64.

create a pipenv

I would prefer to avoid this.

Michael's avatar Michael (2021-10-30 03:52:38 -0600) edit
add a comment see more comments

5 Answers

0

Hi,

I just upgraded my license to Wing Pro v9.1.1.2 and am see the error 'Expected django-admin does not exist for c:\services\python\3.11.2\python.exe' when trying to create a Django project using existing folders. A little background ...

Python in installed in c:\services\python\3.11.2 My projects are in the c:\users\myusername\ tree

I've been creating python venv, django projects etc using powershell. After this is all done I tried adding the project into wing and am getting the attached error. Do I need to do everything as a new project within wing to avoid the error?

Any help is appreciated.

Thanks, Jim.

jneundorf's avatar
1
jneundorf
answered 2023-06-11 11:25:56 -0600
edit flag offensive 0 remove flag delete link

Comments

Hello,

I discovered that if django is installed globally the message does not appear. This leads me to think that wing doesn't recognize the project being added has django installed in the venv.

Is this expected behaviour?

jneundorf's avatar jneundorf (2023-06-11 12:19:34 -0600) edit

Sorry, we somehow missed this, which probably should have been a new top-level question and not an answer on an old question. It looks like the project creation code in Wing is looking for django-admin in or near the python executable, which in a venv is also present so it seems like it should work. The locations tried are: Same directory as the python executable, and in the Scripts sub-directory (which is used on Windows). In your venv, where is django-admin relative to the python/python.exe? Also, is it named django-admin.py, django-admin.exe, or just django-admin? I wonder if we're missing some possible case and possibly the layout in a venv can be different than the code is currently expecting. Thanks, and sorry for the long delay on answering this one!

Wingware Support's avatar Wingware Support (2023-06-26 17:10:58 -0600) edit
add a comment see more comments
0

I just tried to have Wing setup a Django project and am still getting the django-admin error, Python 3.10.2/64b, Wing 8.2.0.2 (rev fc50b35b490f).

image description Running C:\Users\xx\AppData\Local\Programs\Python\Python39\python.exe -m venv venv in C:\GitRepo\ee_web2 Running C:\GitRepo\ee_web2\venv\Scripts\python.exe C:\GitRepo\ee_web2\venv\Scripts\pip.exe install --upgrade pip in None Requirement already satisfied: pip in c:\gitrepo\ee_web2\venv\lib\site-packages (21.2.4) Collecting pip Using cached pip-22.0.4-py3-none-any.whl (2.1 MB) Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 21.2.4 Uninstalling pip-21.2.4: Successfully uninstalled pip-21.2.4 Successfully installed pip-22.0.4 Running C:\GitRepo\ee_web2\venv\Scripts\pip.exe install Django in None Collecting Django Using cached Django-4.0.3-py3-none-any.whl (8.0 MB) Collecting tzdata Using cached tzdata-2021.5-py2.py3-none-any.whl (339 kB) Collecting sqlparse>=0.2.2 Using cached sqlparse-0.4.2-py3-none-any.whl (42 kB) Collecting asgiref<4,>=3.4.1 Using cached asgiref-3.5.0-py3-none-any.whl (22 kB) Installing collected packages: tzdata, sqlparse, asgiref, Django Successfully installed Django-4.0.3 asgiref-3.5.0 sqlparse-0.4.2 tzdata-2021.5 Expected django-admin does not exist: C:\GitRepo\ee_web2\venv\Scripts\django-admin

image description image description

RunDeep's avatar
58
RunDeep
answered 2022-03-14 17:23:40 -0600
edit flag offensive 0 remove flag delete link

Comments

I'm seeing this also and will try to get an update out soon. I'll post again when done.

Wingware Support's avatar Wingware Support (2022-03-15 08:04:47 -0600) edit

The above problem and a few others related to this should be fixed in 8.2.0.3, which you can get now with Check for Updates from the Help menu. Thanks for reporting this problem, and please let us know if you run into any other issues.

Wingware Support's avatar Wingware Support (2022-03-15 09:35:23 -0600) edit
1

Looks good, created a project without any errors

RunDeep's avatar RunDeep (2022-03-15 19:21:27 -0600) edit

Great, I'm glad that solved it.

Wingware Support's avatar Wingware Support (2022-03-15 20:57:50 -0600) edit
add a comment see more comments
1

I'm afraid, we are not yet finished. I have 8.1.1.0 (rev 0721a05fd121) installed now and during the django project generation, the following error appears:

Project creation failed with the following errors:

Could not find manage.py and settings in the source directory

Details:

Running v:\bin\scripting\python\3.9.5\python-3.9.5.amd64\python.exe v:\bin\scripting\python\3.9.5\python-3.9.5.amd64\Scripts\django-admin.py --version in v:\my\finance\av
3.2.9
v:\bin\scripting\python\3.9.5\python-3.9.5.amd64\Scripts\django-admin.py:17: RemovedInDjango40Warning: django-admin.py is deprecated in favor of django-admin.
  warnings.warn(
Could not find manage.py and settings in the source directory

Django version is 3.9.2, I have no idea what kind of deprecation handling for his next major version it is doing there. No files are created in v:\my\finance\av (the planned pre-existing source directory)

Michael

p.s. Wrote this as answer, because the formatting is better.

Michael's avatar
171
Michael
answered 2021-11-18 14:56:52 -0600
edit flag offensive 0 remove flag delete link

Comments

Indeed, we're failing to prefer django-admin.exe. I've fixed that for 8.1.1.1+. I'm not sure that's the problem, though. Could you provide info on how/where manage.py and settings are laid out in your project? And did you select your project directory that contains those (somewhere in the directory tree) during project creation? (I'm assuming you chose the Use Existing Directory option in the New Project dialog).

Wingware Support's avatar Wingware Support (2021-11-18 15:20:03 -0600) edit

I'm assuming you chose the Use Existing Directory option in the New Project dialog

Yes. I checked in the meantime, it doesn't matter. Same error when creating the directory during the process.

Could you provide info on how/where manage.py and settings are laid out in your project?

I have no idea, what the meaning of this file / these settings is / are (also, Django is a whole new python tool stack for me). I'm simply trying to create a new Django project from Wing, with no preconditions.

Michael's avatar Michael (2021-11-18 17:10:32 -0600) edit

I am seeing problems also now and am investigating.

Wingware Support's avatar Wingware Support (2021-11-19 13:31:24 -0600) edit

Oops, no my problem was running a much older version of Wing. It's working for me with Wing 8.1.1 (without the above-mentioned fix for finding djanbgo-admin.exe) and Python 3.10 if I create a new directory on the first New Project screen and on the second New Project screen I either create a new pipenv or use an existing Python installation that already has Django installed into it. I'd strongly recommend setting up new environment using pipenv or virtualenv because then you don't have to worry about missing required modules. Django does not come with Python so needs to be installed separately unless you let Wing do that for you. If you don't know Django then you definitely also want to create a new project directory along with your Wing project because that sets up a Django development project on disk (a non-trivial ... (more)

Wingware Support's avatar Wingware Support (2021-11-19 13:52:44 -0600) edit
add a comment see more comments
0

This was fixed in 8.1.1.

Wingware Support's avatar
4k
Wingware Support
answered 2021-11-17 09:16:14 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

Wing assumes that django-admin[.py] is in the same directory as python[.exe], which is apparently not the case in a portable Python base installation and possibly also with regular Python on Windows when not using a virtual environment of any kind. I'm marking this as a bug report and we'll try to fix it soon. Thanks for reporting this problem!

Wingware Support's avatar
4k
Wingware Support
answered 2021-11-01 14:21:29 -0600
edit flag offensive 0 remove flag delete link

Comments

The fix will be in update 8.1.1.0, which should be out in the next week or so. Thanks again for reporting this problem! It looks like it affects any Django project setup on Windows if no environment is being created.

Wingware Support's avatar Wingware Support (2021-11-11 10:53:08 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer