Skip to content

Commit 5a2478f

Browse files
committed
Update installation guide to Django 1.7 and move it into docs/.
1 parent 1243a0b commit 5a2478f

File tree

6 files changed

+186
-10
lines changed

6 files changed

+186
-10
lines changed

docs-requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-r dev-requirements.txt
2+
3+
sphinx_rtd_theme

docs/Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5+
PYTHON = python
56
SPHINXOPTS =
67
SPHINXBUILD = sphinx-build
78
PAPER =
@@ -19,11 +20,12 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sou
1920
# the i18n builder cannot share the environment and doctrees with the others
2021
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
2122

22-
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
23+
.PHONY: help clean html htmlview dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
2324

2425
help:
2526
@echo "Please use \`make <target>' where <target> is one of"
2627
@echo " html to make standalone HTML files"
28+
@echo " htmlview to open the index page built by the html target in your browser"
2729
@echo " dirhtml to make HTML files named index.html in directories"
2830
@echo " singlehtml to make a single large HTML file"
2931
@echo " pickle to make pickle files"
@@ -54,6 +56,9 @@ html:
5456
@echo
5557
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
5658

59+
htmlview: html
60+
$(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
61+
5762
dirhtml:
5863
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
5964
@echo

docs/source/conf.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import sys
1717
import os
18+
import time
1819

1920
# If extensions (or modules to document with autodoc) are in another directory,
2021
# add these directories to sys.path here. If the directory is relative to the
@@ -49,7 +50,7 @@
4950

5051
# General information about the project.
5152
project = 'Python.org Website'
52-
copyright = '2014, Frank Wiles'
53+
copyright = '%s, Python Software Foundation' % time.strftime('%Y')
5354

5455
# The version info for the project you're documenting, acts as replacement for
5556
# |version| and |release|, also used in various other places throughout the
@@ -103,7 +104,13 @@
103104

104105
# The theme to use for HTML and HTML Help pages. See the documentation for
105106
# a list of builtin themes.
106-
html_theme = 'default'
107+
try:
108+
import sphinx_rtd_theme
109+
except ImportError:
110+
html_theme = 'default'
111+
else:
112+
html_theme = 'sphinx_rtd_theme'
113+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
107114

108115
# Theme options are theme-specific and customize the look and feel of a theme
109116
# further. For a list of options available for each theme, see the
@@ -132,7 +139,7 @@
132139
# Add any paths that contain custom static files (such as style sheets) here,
133140
# relative to this directory. They are copied after the builtin static files,
134141
# so a file named "default.css" will overwrite the builtin "default.css".
135-
html_static_path = ['_static']
142+
html_static_path = []
136143

137144
# Add any extra paths that contain custom files (such as robots.txt or
138145
# .htaccess) here, relative to this directory. These files are copied
@@ -202,7 +209,7 @@
202209
# author, documentclass [howto, manual, or own class]).
203210
latex_documents = [
204211
('index', 'PythonorgWebsite.tex', 'Python.org Website Documentation',
205-
'Frank Wiles', 'manual'),
212+
'Python Software Foundation', 'manual'),
206213
]
207214

208215
# The name of an image file (relative to this directory) to place at the top of
@@ -232,7 +239,7 @@
232239
# (source start file, name, description, authors, manual section).
233240
man_pages = [
234241
('index', 'pythonorgwebsite', 'Python.org Website Documentation',
235-
['Frank Wiles'], 1)
242+
['Python Software Foundation'], 1)
236243
]
237244

238245
# If true, show URL addresses after external links.
@@ -246,7 +253,7 @@
246253
# dir menu entry, description, category)
247254
texinfo_documents = [
248255
('index', 'PythonorgWebsite', 'Python.org Website Documentation',
249-
'Frank Wiles', 'PythonorgWebsite', 'One line description of project.',
256+
'Python Software Foundation', 'PythonorgWebsite', '',
250257
'Miscellaneous'),
251258
]
252259

docs/source/install.rst

+152-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,157 @@
11
Installing
22
==========
33

4-
**NOTE:** The Python.org website is built using Django and Python 3
4+
Using Vagrant
5+
-------------
56

6-
It can be installed much like any other Django site.
7+
You can ignore the below instructions by using Vagrant. After installing::
78

8-
TODO
9+
$ vagrant up
10+
$ vagrant ssh
11+
12+
The box will be provisioned by Chef with Python 3.3, a virtualenv set up with
13+
requirements installed, and a database ready to use. The virtualenv is
14+
activated upon login.
15+
16+
.. note:: You will need to run ``./manage.py createsuperuser`` to use the admin.
17+
18+
19+
Getting started
20+
---------------
21+
22+
You'll want a virtualenv. Python 3.3 actually includes virtualenv built-in, so
23+
you can do::
24+
25+
$ pyvenv-3.3 <env>
26+
$ source <env>/bin/activate
27+
28+
But you can also use your existing virtualenv and virtualenvwrapper::
29+
30+
$ virtualenv --python=python3.3 <env>
31+
$ mkvirtualenv --python=python3.3 <env>
32+
33+
And then you'll need to install dependencies::
34+
35+
$ pip install -r dev-requirements.txt
36+
37+
If you want to install the default Read the Docs theme, you can do::
38+
39+
$ pip install -r docs-requirements.txt
40+
41+
.. note:: For deployment, you can just use ``requirements.txt``.
42+
43+
In your development environment, you won't need a production ready database, so
44+
you can use Sqlite3::
45+
46+
$ export DATABASE_URL=sqlite:///pydotorg.db
47+
48+
You can also add the following setting to ``pydotorg/settings/local.py``::
49+
50+
DATABASES = {
51+
'default': dj_database_url.parse('sqlite:///pydotorg.db')
52+
}
53+
54+
Not it's time to run migrations::
55+
56+
$ ./manage.py migrate
57+
58+
To compile and compress static media, you will need *compass* and
59+
*yui-compressor*::
60+
61+
$ gem install bundler
62+
$ bundle install
63+
64+
.. note::
65+
66+
To install *yui-compressor*, use your OS's package manager or download it
67+
directly then add the executable to your ``PATH``.
68+
69+
To load all fixture files::
70+
71+
$ invoke load_fixtures
72+
73+
or::
74+
75+
$ ./manage.py loaddata fixtures/*.json
76+
77+
If you want to load a specific fixture, use its application name::
78+
79+
$ ./manage.py loaddata downloads boxes
80+
81+
Finally, start the development server::
82+
83+
$ ./manage.py runserver
84+
85+
86+
Running tests
87+
-------------
88+
89+
To run the test suite::
90+
91+
$ ./manage.py test
92+
93+
To generate coverage report::
94+
95+
$ coverage run manage.py test
96+
$ coverage report
97+
98+
Generate an HTML report with ``coverage html`` if you like.
99+
100+
101+
Building documentation
102+
----------------------
103+
104+
To build this documentation locally::
105+
106+
$ make -C docs/ htmlview
107+
108+
If you don't want to open the browser automatically, you can do::
109+
110+
$ make -C docs/ html
111+
112+
113+
Useful commands
114+
---------------
115+
116+
* Create a super user (for a new DB)::
117+
118+
$ ./manage.py createsuperuser
119+
120+
* Want to save some data from your DB before nuking it, and then load it back
121+
in?::
122+
123+
$ ./manage.py dumpdata --format=json --indent=4 $APPNAME > fixtures/$APPNAME.json
124+
125+
126+
Troubleshooting
127+
---------------
128+
129+
If you hit an error getting this repo setup, file a pull request with helpful
130+
information so others don't have similar problems.
131+
132+
Python 3.3 and OSX 10.8.2
133+
^^^^^^^^^^^^^^^^^^^^^^^^^
134+
135+
Homebrew's recipe for Python 3.3 has some difficulty installing distribute
136+
and pip in a virtualenv. The `python.org installer for OSX <https://www.python.org/download/>`_
137+
may work better, if you're having trouble.
138+
139+
Freetype not found on OSX
140+
^^^^^^^^^^^^^^^^^^^^^^^^^
141+
142+
::
143+
144+
_imagingft.c:60:10: fatal error: 'freetype/fterrors.h' file not found
145+
#include <freetype/fterrors.h>
146+
^
147+
1 error generated.
148+
error: command 'clang' failed with exit status 1
149+
150+
If you've installed *freetype* (``brew install freetype``), you may need
151+
to symlink version 2 into location for version 1 as mentioned by `this
152+
Stack Overflow
153+
question <http://stackoverflow.com/questions/20325473/error-installing-python-image-library-using-pip-on-mac-os-x-10-9>`_.
154+
155+
Freetype 2.5.3 is known to work with this repository::
156+
157+
$ ln -s /usr/local/include/freetype2 /usr/local/include/freetype

pydotorg/settings/base.py

+6
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@
165165

166166
]
167167

168+
# Fixtures
169+
170+
FIXTURE_DIRS = (
171+
os.path.join(BASE, 'fixtures'),
172+
)
173+
168174
### Testing
169175

170176
SKIP_NETWORK_TESTS = True

tasks.py

+6
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ def copy_data_from_staging(keep=False):
3939
def clear_pycs():
4040
""" Remove all .pyc files from project directory """
4141
run("""find {} -name "*.pyc" -delete""".format(BASE_DIR))
42+
43+
44+
@invoke.task
45+
def load_fixtures():
46+
"""Load all fixture files."""
47+
run('./manage.py loaddata fixtures/*.json')

0 commit comments

Comments
 (0)