0

I have Python2.7 and Django 1.3.1, running on windows 7 32bit

When I type 'python django-admin.py startapp myproject', the folder that is created looks like:

mysite/ init.py models.py tests.py views.py

instead of

mysite/ init.py manage.py settings.py urls.py

Now the reason I have to type in 'python django-admin.py startapp myproject' instead of just 'django-admin.py startapp myproject' is because .py files are not properly associated with python, a solution was suggested in this thread: django-admin.py is not working properly

I tried it but I could get the proper association for some reason. I also made sure django-admin.py should be opened with python.exe file through Properties. Finally both django-admin.py and python.exe are added to system path as configured in Computer ->properties>advanced->environmental variables.

So a bit out of ideas here...

Community
  • 1
  • 1
xiaolingxiao
  • 4,793
  • 5
  • 41
  • 88
  • P.S. this command worked before and am not sure what changed. In addition, other python commands such as 'python manage.py runserver' works even though when I type in 'assoc .py' into the command prompt, I get 'File association not found for extensions .py' – xiaolingxiao Jul 01 '12 at 23:44

3 Answers3

11

1 django-admin.py startproject myproject
creates a project and files like init.py, manage.py, settings.py, urls.py
2 python manage.py startapp appname
creates a app inside my project and files like init.py, models.py, tests.py, views.py

kartheek
  • 6,434
  • 3
  • 42
  • 41
8

You want startproject instead of startapp.

Check out the docs at https://docs.djangoproject.com/en/dev/ref/django-admin/#startproject-projectname-destination

Andbdrew
  • 11,788
  • 4
  • 33
  • 37
4

django-admin.py startproject myproject

creates a project and files like

  • __init__.py use files as an global modules
  • manage.py to manage project like, Syncdb, migrate, startserver
  • settings.py Contains The Project Settings
  • urls.py Contains Project URL,you can include the app url file

python manage.py startapp appname

creates a app inside my project and files like

  • __init__.py use files as an global modules
  • models.py You can write your model classes here
  • tests.py To write test cases
  • views.py App URLs
Dadaso Zanzane
  • 6,039
  • 1
  • 25
  • 25