Program-Me-Rev
Program-Me-Rev

Reputation: 6624

How to start a new Django project

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.

Upvotes: 0

Views: 1916

Answers (3)

Wasim Shaikh
Wasim Shaikh

Reputation: 1

Boilerplate Code 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

Those commands will create commonly used structure for django.

Upvotes: 0

Chris Kavanagh
Chris Kavanagh

Reputation: 449

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.

Upvotes: 1

Program-Me-Rev
Program-Me-Rev

Reputation: 6624

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¶

Upvotes: 1

Related Questions