Running ReadTheDocs on Windows

GuidesWeb Development

Hey everyone,

This is a quick guide on how to setup your own readthedocs server on Windows.

Install Python 2.7: https://www.python.org/downloads/

Install virtual env using pip via command prompt (run as administrator):
c:Python27>python.exe scriptspip.exe install virtualenv

Create a virtual environment:
c:Python27>scriptsvirtualenv.exe c:readthedocs c:readthedocsScripts>activate.bat (readthedocs) c:readthedocsScripts>

Create a folder and clone the repository:
(readthedocs) c:readthedocsScripts>md checkouts (readthedocs) c:readthedocsScripts>cd checkouts (readthedocs) c:readthedocsScriptscheckouts>git clone http://github.com/rtfd/readthedocs.org.git Cloning into 'readthedocs.org'... remote: Counting objects: 47896, done. remote: Compressing objects: 100% (53/53), done. remote: Total 47896 (delta 19), reused 0 (delta 0), pack-reused 47843 Receiving objects: 100% (47896/47896), 37.91 MiB | 8.76 MiB/s, done. Resolving deltas: 100% (31783/31783), done. Checking connectivity... done.

Get and install dependencies using pip:
(readthedocs) c:readthedocsScriptscheckouts>cd readthedocs.org (readthedocs) c:readthedocsScriptscheckoutsreadthedocs.org>git clone http://github.com/rtfd/readthedocs.org.git

Ran into the following error: no module named django.core.management (probably caused by having two version of python installed)
(readthedocs) c:readthedocsScriptscheckoutsreadthedocs.org>c:Python27python.exe c:readthedocsScriptspip.exe install django --upgrade Collecting django Using cached Django-1.10.2-py2.py3-none-any.whl Installing collected packages: django Successfully installed django-1.10.2 You are using pip version 8.1.1, however version 8.1.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' comm and.

Build the database:
(readthedocs) c:readthedocsScriptscheckoutsreadthedocs.org>c:Python27pytho n.exe C:readthedocsScriptscheckoutsreadthedocs.orgmanage.py syncdb Operations to perform: Synchronize unmigrated apps: allauth, messages, django_extensions, django_grav atar, rest_framework, annoying, textclassifier, corsheaders, copyright, privacy, django_countries, humanize, rtd_tests, haystack, doc_builder, staticfiles, rest api, bitbucket_oauth2, bitbucket, notifications, djangosecure, pagination, githu b, djcelery, payments Apply all migrations: core, account, builds, gold, sessions, admin, guardian, tastypie, messages_extends, comments, sites, contenttypes, redirects, auth, tagg it, oauth, bookmarks, donate, projects, socialaccount Synchronizing apps without migrations: Creating tables... Creating table corsheaders_corsmodel Creating table celery_taskmeta Creating table celery_tasksetmeta Creating table djcelery_intervalschedule Creating table djcelery_crontabschedule Creating table djcelery_periodictasks Creating table djcelery_periodictask Creating table djcelery_workerstate Creating table djcelery_taskstate Running deferred SQL... Installing custom SQL... Running migrations: Rendering model states... DONE Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying account.0001_initial... OK Applying account.0002_email_max_length... OK Applying admin.0001_initial... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0002_alter_permission_name_max_length... OK Applying auth.0003_alter_user_email_max_length... OK Applying auth.0004_alter_user_username_opts... OK Applying auth.0005_alter_user_last_login_null... OK Applying auth.0006_require_contenttypes_0002... OK Applying taggit.0001_initial... OK Applying projects.0001_initial... OK Applying builds.0001_initial... OK Applying projects.0002_add_importedfile_model... OK Applying bookmarks.0001_initial... OK Applying builds.0002_build_command_initial... OK Applying comments.0001_initial... OK Applying core.0001_initial... OK Applying core.0002_make_userprofile_user_a_onetoonefield... OK Applying core.0003_add_banned_status... OK Applying donate.0001_initial... OK Applying donate.0002_dollar-drop-choices... OK Applying donate.0003_add-impressions... OK Applying donate.0004_rebase-impressions-on-base... OK Applying donate.0005_add-geo-filters... OK Applying donate.0006_add-geo-data... OK Applying donate.0007_add-impression-totals... OK Applying gold.0001_initial... OK Applying guardian.0001_initial... OK Applying messages_extends.0001_initial... OK Applying sites.0001_initial... OK Applying socialaccount.0001_initial... OK Applying socialaccount.0002_token_max_lengths... OK Applying oauth.0001_initial... OK Applying oauth.0002_combine_services... OK Applying oauth.0003_move_github... OK Applying oauth.0004_drop_github_and_bitbucket_models... OK Applying oauth.0005_add_account_relation... OK Applying oauth.0006_move_oauth_source... OK Applying oauth.0007_org_slug_nonunique... OK Applying projects.0003_project_cdn_enabled... OK Applying projects.0004_add_project_container_image... OK Applying projects.0005_sync_project_model... OK Applying projects.0006_add_domain_models... OK Applying projects.0007_migrate_canonical_data... OK Applying projects.0008_add_subproject_alias_prefix... OK Applying projects.0009_add_domain_field... OK Applying projects.0010_migrate_domain_data... OK Applying projects.0011_delete-url... OK Applying projects.0012_proper-name-for-install-project... OK Applying projects.0013_add-container-limits... OK Applying projects.0014_add-state-tracking... OK Applying projects.0015_add_project_allow_promos... OK Applying projects.0016_build-queue-name... OK Applying projects.0017_add_domain_https... OK Applying redirects.0001_initial... OK Applying sessions.0001_initial... OK Applying taggit.0002_auto_20150616_2121... OK Applying tastypie.0001_initial... OK

Starting the readthedocs server:
D:UsersChrisO>C:readthedocsScriptsactivate.bat

(readthedocs) D:UsersChrisO>c:Python27python.exe C:readthedocsScriptschec
koutsreadthedocs.orgmanage.py runserver
Performing system checks…

System check identified no issues (1 silenced).
October 21, 2016 – 11:16:17
Django version 1.8.3, using settings ‘readthedocs.settings.dev’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

Create a new readthedocsproject:
I followed this guide: http://read-the-docs.readthedocs.io/en/latest/getting_started.html#in-rst

Creating the new project: C:readthedocs>md whatibroke C:readthedocs>cd whatibroke C:readthedocswhatibroke>C:readthedocsScriptssphinx-quickstart.exe Welcome to the Sphinx 1.3.5 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Installing a theme – sphinx_rtd_theme (optional step):
c:readthedocsScripts>activate.bat (readthedocs) c:readthedocsScripts>cd c:readthedocswhatibroke (readthedocs) c:readthedocswhatibroke>pip install sphinx_rtd_theme

In your conf.py file (C:readthedocswhatibrokeconf.py):
import sphinx_rtd_theme html_theme = "sphinx_rtd_theme" html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Building your output:
c:readthedocsScripts>activate.bat (readthedocs) c:readthedocsScripts>cd c:readthedocswhatibroke (readthedocs) c:readthedocswhatibroke>make html Running Sphinx v1.3.5 loading pickled environment... done building [mo]: targets for 0 po files that are out of date building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed looking for now-outdated files... none found no targets are out of date. build succeeded.

Build finished. The HTML pages are in _build/html.

Thanks to the following stackoverflow post for a lot of the information here: http://stackoverflow.com/a/19892345/522859