如何创建一个示例django项目? [英] How to create a sample django project?

查看:52
本文介绍了如何创建一个示例django项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这对我不起作用。

$ python django-admin.py startproject myproject

我正在Windows系统上运行ubuntu虚拟机。
默认情况下,ubuntu 12.04随python 2.7.3一起提供,因此我使用的是通过下载以下命令下载或安装的
(自从我对django不熟悉以来所做的任何事情)-

I am running a ubuntu virtual m/c on my windows system. By default ubuntu 12.04 comes with python 2.7.3 so I am using that only I downloaded or installed (whatever it does since I am new to django) by issuing the following command-

git clone https://github.com/django/django.git
django directory is successfully created.

我想创建一个示例django应用程序。因此,为此,我发出以下命令-

I want to create a sample django application. So for this I am issuing the following command-

$ python django-admin.py startproject tango_with_django_project

显然,由于默认的ubuntu python不知道django已安装,因此它将抛出错误。

Obviously, it will throw error since the default ubuntu python doesn't know that django has been installed.

我的问题是如何将python与该Django集成并创建示例django应用程序?

My Question is how to integrate python with this Django and create a sample django application?

推荐答案

上面为您提供的指向文档的注释当然是正确的,但是还有其他资源可以帮助您以正确的方式启动网站。特别是 cookiecutter 及其相关的 Django模板将立即为您设置一些非常好的默认值和有价值的第三方应用程序。如果您有现金可以花,我也衷心推荐这本书两勺Django ,由编写了我链接到的两个应用程序的人编写。

The comments above pointing you to the documentation are of course correct, but there are also other resources that can help you start your site the 'right' way. In particular, cookiecutter and its related Django template will get you set up with some really good defaults and valuable third-party apps straight away. If you have cash to spend I'd also heartily recommend the book Two Scoops of Django, by the people who wrote the two applications to which I've linked.

Jeff Knupp还在以正确的方式启动Django项目,其中涵盖了有用的主题,例如重要性:

Jeff Knupp has also written a thoroughly useful blog post on starting a Django project the right way, which covers useful topics such as the importance of:

  • source control;
  • automated testing (see also this excellent book);
  • isolating your development environment to smooth deployment; and
  • managing your database with migrations (included in Django since version 1.7).

这篇关于如何创建一个示例django项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆