https://github.com/graphql-python/swapi-graphene
GraphQL Starwars API using Graphene and Django
https://github.com/graphql-python/swapi-graphene
Last synced: 8 months ago
JSON representation
GraphQL Starwars API using Graphene and Django
- Host: GitHub
- URL: https://github.com/graphql-python/swapi-graphene
- Owner: graphql-python
- Created: 2015-10-08T07:36:47.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-12-03T09:11:23.000Z (almost 6 years ago)
- Last Synced: 2025-03-17T11:01:19.852Z (9 months ago)
- Language: Python
- Homepage: http://swapi.graphene-python.org
- Size: 127 KB
- Stars: 173
- Watchers: 13
- Forks: 34
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-graphql - swapi-graphene - A GraphQL schema and server using [Graphene](https://graphene-python.org). (Examples / Python Examples)
- awesome-graphql - swapi-graphene - A GraphQL schema and server using [Graphene](https://graphene-python.org). (Implementations / Python)
- awesome-graphql - swapi-graphene - A GraphQL schema and server using [Graphene](https://graphene-python.org). (Examples / Python Examples)
- fucking-awesome-graphql - swapi-graphene - A GraphQL schema and server using 🌎 [Graphene](graphene-python.org). (Implementations / Python)
README
# GraphQL SWAPI using Graphene
This is a integration example of [Graphene](http://graphene-python.org) in Django.
[View demo](http://swapi.graphene-python.org/)
## Structure
All the [models](./starwars/models.py) and [fixtures](./starwars/fixtures/) are based in the original [swapi project](https://github.com/phalt/swapi).
The schema (*where all the magic happens*) is in [starwars/schema.py](./starwars/schema.py).
> Look ma, a GraphQL integration with Django models in less than 150 LOC!
## Deploying locally
You can also have your own GraphQL Starwars example running on locally.
Just run the following commands and you'll be all set!
```bash
git clone git@github.com:graphql-python/swapi-graphene.git
cd swapi-graphene
# Install the requirements
pip install -r requirements_base.txt
# Collect static data
python manage.py collectstatic
# Setup the db and load the fixtures
python manage.py migrate
```
Once you have everything done, just run:
```bash
python manage.py runserver
```
Open your browser and visit [localhost:8080](http://localhost:8080/) et voilá!
## Deploying on [Heroku](http://heroku.com)
To get your own GraphQL Starwars example running on Heroku, click the button below:
[](https://heroku.com/deploy?template=https://github.com/graphql-python/swapi-graphene)
Fill out the form, and you should be cooking with gas in a few seconds.