djangoproject本地部署

1. 下载源码:https://codeload.github.com/django/djangoproject.com/zip/master
2. 本地解压
3. 下载python2.7 install https://www.python.org/downloads/
3.1 yum安装zlib-devel-1.2.3-29.el6.x86_64,修改Modules/Setup,开启zlib支持

464 # Andrew Kuchling's zlib module.
465 # This require zlib 1.1.3 (or later).
466 # See http://www.gzip.org/zlib/
467 zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz

4. 下载pip工具,安装pip:https://bootstrap.pypa.io/get-pip.py

5. 安装postgresql https://ftp.postgresql.org/pub/source/v9.0.2/postgresql-9.0.2.tar.gz

./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &

6. 按照readme.rst安装

#. Create a virtualenv

#. Install dependencies::

pip install -r requirements/dev.txt

Alternatively use the make task::

make install

#. Create a 'secrets.json' file in the directory above the checkout, containing
something like::

{ "secret_key": "xyz",
"superfeedr_creds": ["any@email.com", "some_string"] }

#. Create databases::

createuser -d djangoproject
createdb -O djangoproject djangoproject
createuser -d code.djangoproject
createdb -O code.djangoproject code.djangoproject

#. Create tables::

psql -d code.djangoproject < tracdb/trac.sql

./manage.py migrate

#. Create a superuser::

./manage.py createsuperuser

#. Populate the www and docs hostnames in the django.contrib.sites app::

./manage.py loaddata dev_sites

#. For docs::

./manage.py loaddata doc_releases
./manage.py update_docs

#. For dashboard::

./manage.py loaddata dashboard_example_data
./manage.py update_metrics

#. Point the ``www.djangoproject.dev``, ``docs.djangoproject.dev`` and ``dashboard.djangoproject.dev``
hostnames with your ``/etc/hosts`` file to ``localhost``/``127.0.0.1``.
Here's how it could look like::

127.0.0.1 docs.djangoproject.dev www.djangoproject.dev dashboard.djangoproject.dev

If you're on Mac OS and don't feel like editing the ``/etc/hosts`` file
manually, there is a great preference pane called `Hosts.prefpane`_. On
Ubuntu there is a `built-in network admin`_ GUI to do the same. Remember
both require admin priviledges, just like you'd need when editing
``/etc/hosts`` with your favorite editor.

.. _`Hosts.prefpane`: https://github.com/specialunderwear/Hosts.prefpane
.. _`built-in network admin`: https://help.ubuntu.com/community/NetworkAdmin

#. Finally run the server::

make run

8. Windows本地host文件修改:C:WindowsSystem32driversetchosts 中添加如下:

192.168.31.123    docs.djangoproject.dev
192.168.31.123    www.djangoproject.dev
192.168.31.123    dashboard.djangoproject.dev

9. 本地访问,幸福的码农生活才刚刚开始 ^_^

原文地址:https://www.cnblogs.com/forilen/p/4375824.html