Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ See deployed at http://ivanc.uk
2. A [Django server app](/server) that assists the React app by providing data via a REST API.
See deployed at https://api.ivanc.uk

## React app
## React App

Source code located under `/web-client`. This React app is set up with [Webpack](https://webpack.github.io/) and
[Express](http://expressjs.com/) so that the React components are rendered in the server side.

#### Getting started
#### Getting Started
1. `npm install`: install app dependencies.
3. Make sure the companion API app is running at`http://localhost:8000/`
4. `npm start`: start the dev server at `http://localhost:3000/`
Expand All @@ -31,22 +31,22 @@ There are a couple of **environment variables** that need setting up before depl
* `GA_TRACKING_CODE`: Your Google Analytics tracking code.


## Django server app
## Django Server App

Source code located under `/server`. This Django API provides data such as a list of apps, articles and open source repositories through a REST API. It also provides an admin panel that allows adding, deleting and amending data with ease. It's implemented using [Django REST Framework](http://www.django-rest-framework.org/).

#### Getting started
* Create a Python virtual environment under `/server`. You can follow [this guide](http://docs.python-guide.org/en/latest/dev/virtualenvs/).
* Set up the Django settings environment variable: `export DJANGO_SETTINGS_MODULE=ivanc.dev_settings`. To avoid having to do this every time you can add this line to the `activate` script file located in your virtual environment `env/bin/activate`
* Activate the environment: `source env/bin/activate`
* Install dependencies: `pip install -r requirements-dev.txt`
#### Getting Started
* Create a Python Virtual Environment under `/server`. You can follow [this guide](http://docs.python-guide.org/en/latest/dev/virtualenvs/).
* Set up the Django settings Environment Variable: `export DJANGO_SETTINGS_MODULE=ivanc.dev_settings`. To avoid having to do this every time you can add this line to the `activate` script file located in your Virtual Environment `env/bin/activate`
* Activate the Environment: `source env/bin/activate`
* Install Dependencies: `pip install -r requirements-dev.txt`
* Now you're ready to run the dev server: `python manage.py runserver`

#### Testing
This Django project contains test for all endpoints. You can run them with `python manage.py test`. Some endpoints call external APIs. In order to avoid flaky tests, these external interactions are mocked using [VCR.py](https://github.com/kevin1024/vcrpy). Note the first time you run them they will perform real HTTP interactions. Consecutive executions will reuse the first response and the tests will no longer call the external API.

#### Deployment
This app can be deployed as a Django application on Heroku or Dokku. The following **environment variables** are expected:
This app can be Deployed as a Django application on Heroku or Dokku. The following **environment variables** are expected:

* `DJANGO_SETTINGS_MODULE`: This must point to the prod settings file `ivanc.prod_settings`
* `DJANGO_SECRET_KEY`: A random key used by Django. More info [here](https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-SECRET_KEY).
Expand Down