如何在Windows下设置Django项目?

时间:2014-09-26 08:48:47

标签: django windows

我试图建立一个django项目,但我失败了。

  • 首先,我有一台Windows 8机器。

  • 我的PATH变量是:

C:\Python34\;C:\Python34\Scripts;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe

  • 当我打开PyCharm并输入import django时,没有出现错误信息

  • 然后,在官方教程"编写您的第一个Django应用程序"他们说我必须用这个命令django-admin.py startproject mysite

  • 创建一个项目

我在Windows下通过命令提示符尝试使用这些文件夹中的管理权限:

C:\Python34\Scripts

&安培;

C:\Python34\Lib\site-packages\django\bin

在这两个文件夹中,我都可以找到django-admin.py

没有错误消息,它只是通过并没有创建任何文件夹。我在这里缺少什么?

命令提示符的输出是:

C:\Python34\Lib\site-packages\django\bin>django-admin.py startproject myApp
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 conf
igured (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.).

0 个答案:

没有答案