15👍
I solved this problem by using this command as following instead:
django-admin startproject
just remove the “.py” attached to “django-admin”
4👍
I could not get any other stack overflow answers to work either. Getting a venved Django stack running on Win64 is a bit of an ordeal.
But, I found an answer that worked for me here: http://samudranb.com/2012/06/02/how-to-setup-a-djangopython-development-env-on-windows/
Try running from an admin command prompt:
ftype Python.File="[your venv path]\Scripts\python.exe" "%1" %*
Just be sure to set it back to the original value when you’re done.
- What is the right way to use django-allauth with tastypie?
- Docker Django could not connect to server: Connection refused
- Treat NULL as '0' in Django model
- Dict keys with spaces in Django templates
- Where do I install Twitter Bootstrap for Django – main or static folder?
2👍
This will help you understand why your facing that problem and there is also simple solution for that:
http://blog.jayteebee.org/2009/07/importerror-no-module-named-djangocore.html
2👍
I’ve literally searched for hours to a solution for this issue… I came across this video randomly: (https://www.youtube.com/watch?v=lPmkl4jtYgA) where he put “python .\Script\django-admin.py startproject” into the command prompt while in a virtual environment, so I tried the same with the following modification to point to the correct path on my machine “python .\env\Script\django-admin.py startproject”. Voila!
Hopefully this helps someone as it seems there are multiple reasons for this issue.
- Shouldn't django's model get_or_create method be wrapped in a transaction?
- How to pass the remote IP to a proxied service? – Nginx
- How to access POST data inside tastypie custom Authentication
1👍
Windows server 2003 provides the Where command
where python.exe
will show the full path of the current python.exe found on the path, use that to check it’s using the correct one for your virtualenv.
The association issue comes into play because running
file.py
so the .py is argv[0] passes it through the windows association, which won’t follow your venv.
python file.py
will not find file.py unless it’s in the current directory.
So the solution is –
python %VIRTUAL_ENV%\scripts\django-admin.py startproject myproject
This runs python from the current active venv
and uses the venv env variable so it points to the correct location of django-admin.py (or you could give it an absolute path yourself of course)
- Docker Django could not connect to server: Connection refused
- How does Instagram use django?
- Using urls names in views
- Hide password field in GET but not POST in Django REST Framework where depth=1 in serializer
- Centering and aligning width of figcaption tag on image in figure tag
1👍
I had the same problem. I solved that using this command:
(env)C:\environment directory>python Scripts\django-admin.py
This link was helpful for me:
enter link description here
1👍
i had the same problem i am running both python 3.4 and 2.7, so i pip installed Django globally on my machine and when i returned to my virtual environment i was able to create a project with no problems.
- Django is synchronous or asynchronous?
- Django ajax error response best practice
- How to serialize binary files to use with a celery task
- Place to set SQLite PRAGMA option in Django project
1👍
In Windows, you set:
set PATH=C:\virtualenv\python2.7\Scripts REM Scripts folder contains python.exe, pip.exe, django-admin.exe,...
set PYTHONPATH=C:\virtualenv\python2.7\Lib\site-packages REM site-packages folder contains packages of python such as django,...
After, create project mysite by
django-admin.py startproject mysite
0👍
I had this same problem using virtualenv in Terminal in MacOSX (Snow Leopard). My solution to the problem was to change the first line of django-admin.py from
#!/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
to
#!/path-to-your-virtualenv-directory/bin/python
Hope this helps someone.
- How to cache a model method in django?
- Django datefield and timefield to python datetime
- Developing a URL Shortener
- Django Templates: Comparing current url with {% url xyz %}
0👍
I had the same problem and the way I resolve it was by activating my project directory before making migrations and running my server “python manage.py runserver”.
Activate project Directory: source /path/bin/active
Path meaning where your project is stored.
- Django abstract parent model save overriding
- Django AttributeError: 'Alias' object has no attribute 'urls'
- Show a successful message with Class Based Views
- Django: When to run makemigrations?
- Debugging with pycharm, how to step into project, without entering django libraries
0👍
Had same error and This solved it out for me.
source /path/to/virtualwrapper/activate
pip install django
This fix tries to re-install and configure django
- Docker-compose to run django with mongodb
- Set global minimum logging level across all loggers in Python/Django
-1👍
I had the same problem, but I solved it, first I activated the virtual env, then ran:
django-admin.exe startproject project_name