Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/euhmeuh/django-ponies
Sample Django project to get started
https://github.com/euhmeuh/django-ponies
Last synced: about 2 months ago
JSON representation
Sample Django project to get started
- Host: GitHub
- URL: https://github.com/euhmeuh/django-ponies
- Owner: euhmeuh
- License: gpl-3.0
- Created: 2015-12-21T13:57:32.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-21T19:36:31.000Z (about 9 years ago)
- Last Synced: 2024-05-09T23:15:35.903Z (8 months ago)
- Language: Python
- Size: 2.98 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ponies
Sample Django application. Makes use of [pyjade](https://github.com/syrusakbary/pyjade), [tastypie](https://github.com/django-tastypie/django-tastypie) and [whitenoise](https://github.com/evansd/whitenoise).
# How to configure your environment
- (Archlinux) `pacman -S python2 virtualenvwrapper postgresql`
- (Debian/Ubuntu) `apt-get install python2 virtualenvwrapper postgresql`
- `cd` to the cloned repo
- `mkvirtualenv --python=python2.7 ponies`
- `pip install -r requirements.txt`
- `echo -e "DJANGO_SECRET_KEY=\nDJANGO_DEBUG=\nDATABASE_URL=" > .env`# Configure the database
## Local db
- (Archlinux) See https://wiki.archlinux.org/index.php/PostgreSQL
- $`sudo passwd postgres`
- $`su - postgres`
- postgres$`initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'` (unnecessary on some systems)
- $`sudo systemctl start postgresql.service`
- postgres$`createuser -d -r django`
- postgres$`createdb -U django ponies`
- If you get an error on the last step, you might have to change security settings in '/var/lib/postgres/data/pg_hba.conf' to allow local access to your db. Check the postgresql documentation.Then get back to your virtual env and run the migrations:
- $`workon ponies`
- $`export $(cat .env)`
- $`python manage.py migrate`## Distant db
- Open file _.env_
/`
- Edit entry `DATABASE_URL=postgresql://@# Run the server
Your environment is now ready. To run the server, follow these steps:
- (if not done yet) `export $(cat .env)`
- run with `python manage.py runserver`
- open a web browser at http://127.0.0.1:8000/# Get rid of that silly export
If you're tired of typing `export $(cat .env)` every time you open a terminal, try this:
- `cd` to the cloned repo
- `setvirtualenvproject`
- `echo "cdproject && export \$(cat .env)" >> $VIRTUAL_ENV/bin/postactivate`# Create a django admin
To be able to log in http://127.0.0.1:8000/admin you will need an admin account:
- `python manage.py createsuperuser`
# Access the API
You can GET on http://127.0.0.1:8000/api/v1/pony to query the api.