https://github.com/kenmwaura1/movr-app-users
This repo contains the source code for an example implementation of a single-region application for the fictional vehicle-sharing company MovR, as used by the CockroachDB for Python Developers course. Specifically the users section
https://github.com/kenmwaura1/movr-app-users
Last synced: 3 months ago
JSON representation
This repo contains the source code for an example implementation of a single-region application for the fictional vehicle-sharing company MovR, as used by the CockroachDB for Python Developers course. Specifically the users section
- Host: GitHub
- URL: https://github.com/kenmwaura1/movr-app-users
- Owner: KenMwaura1
- License: apache-2.0
- Created: 2021-11-10T19:37:10.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-10T19:37:19.000Z (almost 4 years ago)
- Last Synced: 2025-02-07T16:39:21.205Z (8 months ago)
- Language: Python
- Size: 535 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MovR
This repo contains the source code for an example implementation of a single-region application for the fictional vehicle-sharing company MovR, as used by the CockroachDB for Python Developers course.
- [Overview](#overview) gives a high-level overview the MovR application stack.
## Overview
The application stack consists of the following components:
- A CockroachCloud instance
- Python class definitions that map to the table(s) in the database.
- A backend API that defines the application's connection to the database and the database transactions.
- A Flask server that handles requests from client web browsers.
- HTML templates that define web pages that the Flask server renders.## Setup
### Database and Environment Setup
You'll need to connect to a [CockroachCloud](https://cockroachlabs.cloud/) cluster.
1. Configure environment variables
When running your server, it's easiest if your CockroachCloud connection
string is assigned to the DB_URI variable in the `.env` file. You can paste
it in with the editor of your choice.2. Initialize the database
You can do this with
~~~ shell
$ cat dbinit.sql | cockroach sql --url
~~~
### Application setup1. To run the application, use the following command in the shell:
~~~ shell
$ ./server.py run
~~~1. Navigate to the url provided (defaults to [http://localhost:36257](http://localhost:36257)) to use the application.
### Clean up
1. To shut down the application, `Ctrl+C` out of the Python process.
## Note: Testing
We are still building out the testing suite. Please use at your own risk.