I have added C:\Python27\ for python and C:\Python27\Lib\site-packages\django\bin\ for django to the path variable of environment settings.
But whenever I am running the command
django-admin.py startproject myapp
it is simply opening the django-admin.py file in notepad and not creating any custom django directory and file structure.
I am not able to start with my app development. I didn't faced any problem when I work on ubuntu.
try python django-admin.py startproject myapp
also make sure you have properly installed python ... it should auto-associate files ending in .py
Related
I'm typing django-admin.py startproject project in my vscode terminal on windows, but when I do it just flashes a screen then closes and the project isn't created. It asked me what to open with and I chose python, but the command doesn't do anything. I'm not getting errors either
I was using django-admin.py instead of django-admin, problem is solved
Also you can create django app by typing folliwing command in terminal
python manage.py startapp HelloWorld
Note- It requires already created project.
I tried of creating project in Windows. When I type django-admin.py startproject projectname it takes but it won't created in folder. Everything is installed and previous project also running fine.
instead of django-admin.py startproject projectname, use
django-admin startproject projectname
In windows, open folder where you want to create the project, point to empty space and press Shift and then right mouse click. Choose the option Open Command Window Here. Then in command window, just enter above command.
in windows 10 try running below command for python version 3.6 and higher from windows powershell:
python -m django startproject django_project_1
I have python, pip and django installed. I have created a virtual environment, installed Django inside it and trying to create a new project via the following command:
(venv)c:\Users\username\Desktop\venv>.\Scripts\django-admin.py startproject test_project
Instead of creating the folder test_project along with its file, my PyCharm ide automatically starts and opens the django.admin.py file.
When I check inside my venv folder, only the default folders exists and test_project is not created. Can I know how to fix this please.
django-admin startproject test_project
it should be django-admin, not django-admin.py, If I remember correctly, it is new since 1.7
I am just starting Django these days but I cannot run this command
django-admin.py startproject myproject
Well, CMD does not prompt to say that this command is not recognized. Instead, it just open up my Sublime with the file django-admin.py open. and of course no folder named myproject is created inside the current folder.
I managed to start a Django project by typing commands like
python C:\Python27\Scripts\django-admin.py startproject myproject
But when I omit the part about the absolute path information of django-admin.py, then the command does not work, saying python cannot find such a file inside the current directory.
is there any way I should try to use shorter commands? (PS: I do have C:\Python27\ and C:\Python27\Scripts\ in the PATH)
The easiest way (recommended by the docs) is to just copy django-admin.py to your project's directory.
Technical details: There are workaround in setuptools to make entry points work correctly on Windows, by installing a .exe file that will run correctly even if Python is not set as the default handler for .py files, but Django is not using setuptools but distutils directly. I am not aware of any discussion about moving to setuptools.
Alternatively you can set python.exe as the default program to open .py files, instead of your text editor.
In the past I have had a similar issue on windows. I found that using django-admin as listed below worked.
django-admin.py startproject myproject
I found that it was easy to copy the file django-admin.py into the folder that I wanted the stuff in. Navigate to the file in the command line and then run.
'python django-admin.py startproject myProject'
I have just started using python3.4 and I found everything (packages like pip and django) in c:\pythonpath\scirpts dir. Added that into system path and everything works good. e.g. django-admin startproject mysite
Am new to django and i have been trying to set up a project with no success. When i type
django-admin.py startproject mysite i get this.
C:\Users\WASSWA SAM\Documents\django\djcode>django-admin.py startproject mysite
Usage: django-admin.py subcommand [options] [args]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=all output
etc....
I have added it to my path like so
C:\Python26\Lib\site-packages\django\bin
And when i import django from interactive mode it works perfectly. What could be the problem. I am using Windows 7 and django 1.3.1. I installed it using setup.py.
I had the same problem; I found a working solution at https://groups.google.com/forum/#!msg/django-users/b76qSG3mV6g/jP1o0ny3i2kJ:
python C:\Python27\Scripts\django-admin.py startproject mysite
This is an error with Python's installation on Windows. If you have the regkey entry
HKEY_CLASSES_ROOT\py_auto_file\shell\command\open\
change the value from
"C:\Python27\python.exe" "%1"
to
"C:\Python27\python.exe" "%1" %*
(Or your equivalent installation location)
This ensures that command-line arguments are passed onto python, rather than explicitly ignored. This is fixed in the latest install of Python 2.7. %* is argv[]. "%1" is the script's absolute path.
I had the same problem and could not solve it for hours. Create a new project from Pycharm or any other program you are using, install Django and then instead of running
django-admin.py startproject *project_name* .
run
django-admin startproject *project_name* .
Ommiting .py extension worked for me and everything is running as expected now.
I don't think you need to have django\bin in the path.
I think what you need to add to your PATH though is C:\Python26\scripts and then you should be able to run the startproject script.
In my case, I use eclipse and you can start an eclipse project from within the eclipse environment using PyDev.
Go up to File > New > Other > (within the PyDev Folder) > PyDev Django Project. In the wizard it will allow you to setup most of the commonly used features of Django.