Environment:
Windows 7
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Django==1.7.5
Whenever I try to create a new project:
python .\Scripts\django-admin.py startproject new_project,
I get this error:
python: can't open file 'django-admin.py': [Errno 2] No such file or directory
Where am I going wrong? Thank you all in advance.
If you have the system environment variables set up right (All the three below):
C:\Python34;
C:\Python34\Scripts;
C:\Python34\Lib\site-packages\django\bin
then,
python .\Scripts\django-admin.py startproject new_project,
gives error:
python: can't open file 'django-admin.py': [Errno 2] No such file or directory
since the command is system internally unrecognisable.
Instead, do:
django-admin startproject new_project
Note django-admin
without .py
extension
Read more at Writing your first Django app, part 1¶
If you're using Windows, which I believe you are, leave off the .py on the django-admin.py. In other words, try django-admin startproject new_project.
You can use a project template to create your Django apps. Check out this repository that has most of the recent python libraries:
https://github.com/marcosflp/django-boilerplate/blob/main/README.md
Boilerplate Code<\/strong> To create django as well create django app you have to follow many common commands. for simplicity, kindly follow the below single-line commands separated by semicolon:
django-admin startproject project_name; cd project_name;python3 manage.py startapp app_name; cd app_name; mkdir templates
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.