我正在努力学习django和我已经完成了正式的django 1.7“投票”应用程序和流行的gswd。现在,我正试图理解everyblock.com的代码基,它们为学习目的提供后端代码。这是everyblock上的自述文件
==========
everyblock
==========
This package contains code/templates that are specific to EveryBlock.com. They
are released to fulfill the terms of the grant that funded EveryBlock's
development and are likely not of general use.
Overview
========
The package is split into these directories:
admin -- EveryBlock's internal admin application for managing its data
cities -- City-specific data-acquisition scripts (for 15 U.S. cities)
media -- CSS file for the admin
states -- State-specific data-acquisition scripts
staticmedia -- A Django template tag specific to EveryBlock.com media files
templates -- Templates for the admin
utils -- Various utilities used on EveryBlock.com
Quickstart
==========
0. Install PostgreSQL, PostGIS, Django, psycopg2.
1. Install the everyblock package by putting it on your Python path. Also
install the ebdata, ebpub and ebgeo packages.
2. Start a Django project.
3. Put the smorgasbord of eb-specific settings in your settings file. It's
probably easiest to just start with the file ebpub/settings.py and tweak
that (or import from it in your own settings file). The application won't
work until you set the following:
DATABASE_USER
DATABASE_NAME
DATABASE_HOST
DATABASE_PORT
SHORT_NAME
PASSWORD_CREATE_SALT
PASSWORD_RESET_SALT
METRO_LIST
EB_MEDIA_ROOT
EB_MEDIA_URL
See the documentation/comments in ebpub/settings.py for info on what the
various settings mean.
4. Run "django-admin.py syncdb" to create all of the database tables.
5. Run "django-admin.py runserver" and go to http://127.0.0.1:8000/ in your
Web browser to see the site in action.我下载了ebdata和ebpub包,并解压缩。我能看到文件。我安装了PostgreSQL,PostGIS,Django,psycopg2。我该如何继续下一步。我不知道如何通过将三个包放在python路径中来安装,启动django项目并使其在本地运行。有什么帮助吗?
发布于 2015-02-25 07:01:16
根据安装依赖项的方式,它们可能已经在python路径中了。
从终端运行python,看看是否可以导入django。如果可以的话,它已经在您的python路径中了。
$ python
Python 2.7.9
>>> import django
>>>如果这有效,您可以创建一个新的django项目
django-admin startproject everyblock然后,只需将解压缩的所有文件复制到项目文件夹中,并修改settings.py文件以指向数据库。
注: Everyblock于2009年发行。如果不进行一些更改,它将不会使用Django的最新版本运行。这也不是一个简单的项目,所以你可能想从一个不同的项目开始,直到你变得更舒服。)
https://stackoverflow.com/questions/28712637
复制相似问题