我该如何安装这个python包?

时间:2015-02-25 06:30:49

标签: python django postgresql

我正在努力学习django,我已经完成了官方django 1.7"民意调查"应用程序和流行的gswd。现在我想了解everyblock.com的代码库。他们提供了用于学习目的的后端代码。这是每个块上的README文件

==========
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项目并让它在本地运行。有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

根据您安装依赖项的方式,它们可能已经在您的python路径中。

从终端运行python,看看是否可以导入django。如果你可以,它已经在你的python路径中。

$ python
Python 2.7.9
>>> import django
>>>

如果可行,您可以创建一个新的django项目

django-admin startproject everyblock

然后只需将解压缩的所有文件复制到项目文件夹中,然后修改settings.py文件以指向您的数据库。

(注意:Everyblock是在2009年发布的。如果不进行一些更改,它将无法使用最新版本的Django运行。这也不是一个简单的项目开始,所以你可能想要开始一个不同的项目,直到你有点舒服。)

相关问题