<commit_before>---
layout: 2ColLeft
title: Getting Started Guide
sidebar: nav.html
---

{% include alert/start.html variant="info" %}

If you get stuck, download a <a href="https://github.com/nickcolley/getting-started-todo/archive/master.zip" target="_blank">working version</a>,
or check out the <a href="https://github.com/nickcolley/getting-started-todo" target="_blank">full repo</a>
and <a href="https://github.com/nickcolley/getting-started-todo/commits/master" target="_blank">commit history</a>.

{% include alert/end.html %}

In this tutorial we will write a basic Todo web application based on [TodoMVC](http://todomvc.com/) that syncs to an online CouchDB server. It should take around 10 minutes.

{% include anchor.html class="h3" title="Video Tutorial" hash="video_tutorial" %}

Prefer video tutorials? This guide is available in video format:

{% include iframe.html src="//www.youtube.com/embed/-Z7UF2TuSp0" %}

{% include anchor.html class="h3" title="Download Assets" hash="download" %}

We will start with a template of the project where all the data related functions have been replaced with empty stubs. Download and unzip [pouchdb-getting-started-todo.zip]({{ site.baseurl }}/static/assets/pouchdb-getting-started-todo.zip). When dealing with XHR and IndexedDB you are better off running web pages from a server as opposed to a filesystem. To do this you can run:

{% highlight bash %}
$ cd pouchdb-getting-started-todo
$ python -m SimpleHTTPServer
{% endhighlight %}

Then visit [http://127.0.0.1:8000/](http://127.0.0.1:8000/). If you see the following screenshot, you are good to go:

{% include img.html src="screenshots/todo-1.png" alt="Todo Screenshot" %}

It's also a good idea to open your browser's console so you can see any errors or confirmation messages.

{% include anchor.html class="h3" title="Installing PouchDB" hash="installing_pouchdb" %}

Open `index.html` and include PouchDB in the app by adding a script tag:

{% highlight html %}
<script src="//cdn.jsdelivr.net/npm/pouchdb@{{site.version}}/dist/pouchdb.min.js"></script>
<script src="js/base.js"></script>
<script src="js/app.js"></script>
{% endhighlight %}

PouchDB is now installed in your app and ready to use! (In production, you should use a local copy of the script.)

{% include anchor.html class="h3" title="Creating a database" hash="creating_a_database" %}
<commit_msg>(#7117) - Getting started guide for Python 3 <commit_after>---
layout: 2ColLeft
title: Getting Started Guide
sidebar: nav.html
---

{% include alert/start.html variant="info" %}

If you get stuck, download a <a href="https://github.com/nickcolley/getting-started-todo/archive/master.zip" target="_blank">working version</a>,
or check out the <a href="https://github.com/nickcolley/getting-started-todo" target="_blank">full repo</a>
and <a href="https://github.com/nickcolley/getting-started-todo/commits/master" target="_blank">commit history</a>.

{% include alert/end.html %}

In this tutorial we will write a basic Todo web application based on [TodoMVC](http://todomvc.com/) that syncs to an online CouchDB server. It should take around 10 minutes.

{% include anchor.html class="h3" title="Video Tutorial" hash="video_tutorial" %}

Prefer video tutorials? This guide is available in video format:

{% include iframe.html src="//www.youtube.com/embed/-Z7UF2TuSp0" %}

{% include anchor.html class="h3" title="Download Assets" hash="download" %}

We will start with a template of the project where all the data related functions have been replaced with empty stubs. Download and unzip [pouchdb-getting-started-todo.zip]({{ site.baseurl }}/static/assets/pouchdb-getting-started-todo.zip). When dealing with XHR and IndexedDB you are better off running web pages from a server as opposed to a filesystem. To do this you can run:

{% highlight bash %}
$ cd pouchdb-getting-started-todo
$ python -m SimpleHTTPServer  # for Python 2
$ python -m http.server       # for Python 3
{% endhighlight %}

Then visit [http://127.0.0.1:8000/](http://127.0.0.1:8000/). If you see the following screenshot, you are good to go:

{% include img.html src="screenshots/todo-1.png" alt="Todo Screenshot" %}

It's also a good idea to open your browser's console so you can see any errors or confirmation messages.

{% include anchor.html class="h3" title="Installing PouchDB" hash="installing_pouchdb" %}

Open `index.html` and include PouchDB in the app by adding a script tag:

{% highlight html %}
<script src="//cdn.jsdelivr.net/npm/pouchdb@{{site.version}}/dist/pouchdb.min.js"></script>
<script src="js/base.js"></script>
<script src="js/app.js"></script>
{% endhighlight %}

PouchDB is now installed in your app and ready to use! (In production, you should use a local copy of the script.)

{% include anchor.html class="h3" title="Creating a database" hash="creating_a_database" %}

{'fraction_non_alphanumeric': 0.132137703566275, 'fraction_numerical': 0.01422387136672851, 'mean_word_length': 4.742011834319527, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5967052', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1478, 'n_words': 508}