Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues in initial setup for django project

Tags:

python

django

I am learning Django from the official documentation and while going through the tutorial at https://docs.djangoproject.com/en/1.7/intro/tutorial01/, I am stuck at creating a project part.

When I run django-admin.py startproject mysite I am getting following error

C:\Python34>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=verbose output, 3=very verbose output
  --settings=SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on exception
  --no-color            Don't colorize the command output.
  --version             show program's version number and exit
  -h, --help            show this help message and exit
Type 'django-admin.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django]
    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    makemigrations
    migrate
    runfcgi
    runserver
    shell
    sql
    sqlall
    sqlclear
    sqlcustom
    sqldropindexes
    sqlflush
    sqlindexes
    sqlinitialdata
    sqlmigrate
    sqlsequencereset
    squashmigrations
    startapp
    startproject
    syncdb
    test
    testserver
    validate

Note that only Django core commands are listed as settings are not properly configured

error: Requested setting INSTALLED_APPS, but settings are not configured
    . You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.).

I am using Python 3.4.1 and django 1.7. I don't have any other Django version installed and this is the first project I am creating.

like image 827
Rohit Sasikumar Avatar asked Nov 28 '22 20:11

Rohit Sasikumar


1 Answers

You can just run django-admin startproject mysite(Note: not django-admin.py), because if you install django by pip, a executable program named 'django-admin.exe' will be added to 'C:\Python34\Scripts', which is already in your environment variable 'PATH' normally(if not, add it to PATH).

like image 111
lengxuehx Avatar answered Dec 06 '22 15:12

lengxuehx