{"id":20722022,"url":"https://github.com/transportkollektiv/cykel","last_synced_at":"2025-05-10T23:32:11.849Z","repository":{"id":46803935,"uuid":"201924732","full_name":"transportkollektiv/cykel","owner":"transportkollektiv","description":"Django Bikesharing Backend","archived":false,"fork":false,"pushed_at":"2023-05-23T00:12:38.000Z","size":300,"stargazers_count":81,"open_issues_count":6,"forks_count":14,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-17T03:34:04.289Z","etag":null,"topics":["openbike"],"latest_commit_sha":null,"homepage":"https://docs.openbike.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transportkollektiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-12T12:19:23.000Z","updated_at":"2024-01-10T23:13:21.000Z","dependencies_parsed_at":"2024-11-17T04:01:30.341Z","dependency_job_id":null,"html_url":"https://github.com/transportkollektiv/cykel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transportkollektiv%2Fcykel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transportkollektiv%2Fcykel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transportkollektiv%2Fcykel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transportkollektiv%2Fcykel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transportkollektiv","download_url":"https://codeload.github.com/transportkollektiv/cykel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253497299,"owners_count":21917683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openbike"],"created_at":"2024-11-17T03:33:58.414Z","updated_at":"2025-05-10T23:32:06.840Z","avatar_url":"https://github.com/transportkollektiv.png","language":"Python","funding_links":[],"categories":["[💸 post-capitalism](https://github.com/stars/ketsapiwiq/lists/post-capitalism)"],"sub_categories":[],"readme":"# Cykel\n\nBasic backend for a mobility sharing service. First steps made at [CCCamp 2019](https://events.ccc.de/camp/2019/wiki/Main_Page), further developed, daily used and tested in [the City of Ulm](https://ulm.dev/projects/openbike/) and now maintained by the [transportkollektiv](https://github.com/transportkollektiv).\n\nOpenBike consists of more parts than just cykel - you might want to have a look into the whole [OpenBike Project Documentation](https://docs.openbike.ulm.dev), which also contains installation guidelines for the other parts and operator documentation for running an OpenBike based sharing system.\n\n## Prerequisites\n\n* Python (≥3.7)\n* Postgres database with PostGIS extension. (MySQL and SQLite are not supported anymore)\n* Redis\n\n### Configuration\n\nCreate a file `.env` in the `cykel` subdirectory, with the following contents:\n\n```\n# insert your own random string here\nSECRET_KEY=f2bf0a4e621a16d9eb8253aa7a540f75ed8787b5\n# set to 1 to enable DEBUG output, or 0 to disable\nDEBUG=1\n# configure your database in a format supported by https://github.com/jacobian/dj-database-url\nDATABASE_URL=postgis://localhost/cykel\n# redis connection, you may only have to change this if your redis doesn't live on the same host\nREDIS_URL=redis://localhost:6379/0\n# it is recommended to use a DNS alias for localhost, instead of \"localhost\", for CORS reasons\nALLOWED_HOSTS=lvh.me,localhost\n# set the full URL to the frontend\nUI_SITE_URL=http://lvh.me:1234/\n# CORS origins to whitelist, i.e. the frontend URL (with scheme, without path)\nCORS_ORIGIN_WHITELIST=http://lvh.me:1234\n# Set to true if cykel runs behind a reverse proxy, so the `X-Forwarded-Proto` header gets interpreted and URLs are built correctly with https\nUSE_X_FORWARDED_PROTO=true\n```\n\nInstall the required packages using `pip install -r requirements.txt`. It is recommended to use a virtualenv with your choice of tool, e.g. `pipenv`, in which case you can run `pipenv install` (and `pipenv shell` or prefix `pipenv run` to run commands).\n\nThen run `manage.py migrate` to create the database tables.\n\n### Database configuration for PostgreSQL/PostGIS\n\nYou need to enable the following extensions in the cykel database after installing PostGIS:\n\n```\nCREATE EXTENSION postgis;\nCREATE EXTENSION postgis_topology;\n```\n\nThe DB migration will fail otherwise.\n\n## Running the local server\n\nRun `manage.py runserver`.\n\n### Configuring authentication\n\nFor the administration interface you can run `manage.py createsuperuser` to create an user with administrative rights and access the interface at `http://localhost:8080/admin`.\n\nThen, visit `/admin/` and edit the URL of the first Website (`/admin/sites/site/1/change/`).\n\n### Configuring OAuth\n\nVisit `/admin/socialaccount/socialapp/add/` (Add Social Application).\n\nFor example, for GitHub select \"Provider: GitHub\", \"Name: github\", the Client-Id and Secret are shown in the OAuth application creation process at GitHub.\n\nWhen you create an OAuth2-Application at a provider, you need to enter a callback URL. This URL is in the format `https://\u003chost\u003e/auth/\u003cname\u003e/login/callback/`.\n\n## Update bike location\n\nFor updating the current bike location we provide the `/api/bike/updatelocation` endpoint.\n\nOne project which can use this together with TheThingsNetwork is the [`cykel-ttn`](https://github.com/transportkollektiv/cykel-ttn) adapter. Read the readme in the repository on how to use it - for authentication you need to add a new api key at `/admin/rest_framework_api_key/apikey/`.\n\n\n## Alternative: using Docker Compose\n\n```\ndocker-compose pull\ndocker-compose up -d --build\n```\n\nTo run the `migrate.py` commands that are shown above, prefix them with `docker-compose exec cykel`:\n\n```\ndocker-compose exec cykel python manage.py migrate\ndocker-compose exec cykel python manage.py createsuperuser\n```\n\nTo use other settings (like `ALLOWED_HOSTS`) from above, add them to the `environment` in `docker-compose.yml`.\n\nDocker Compose runs cykel and [voorwiel](https://github.com/transportkollektiv/voorwiel) (one frontend implementation), so you can develop and test with a client right away.\n\n\n## Contributing\n\nWe welcome [issues](https://github.com/transportkollektiv/cykel/issues) and pull requests for new features, bugs or problems you encountered when setting it up. More [Documentation](https://docs.openbike.ulm.dev) or simply small typo fixes are also very appreciated. If you found a vulnerability or other security relevant issue, notify us at `openbike @ ulm.dev`\n\nFor general discussion, feel free to hop into the [public matrix channel](https://matrix.to/#/!ghOLficeAycydtkZtA:matrix.org?via=matrix.org) for openbike and related projects.\n\nGenerally, the cykel python/django code follows [PEP8](https://www.python.org/dev/peps/pep-0008/). We're using `flake8`, `isort`,\n`black` and `docformatter` as style checkers, so those can help you if you're not sure how to format something.\n\nYou can run them all at once using `make style`.\n\n### Tests\n\nTo get stated with tests, you need to install the development dependencies: `pip install -r requirements-dev.txt`\n\nIf you want to run them on your machine, use `pytest`. Tests are also automatically run for pull requests.\n\n`make` will also run all tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransportkollektiv%2Fcykel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransportkollektiv%2Fcykel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransportkollektiv%2Fcykel/lists"}