{"id":13840559,"url":"https://github.com/CleverCloud/django-example","last_synced_at":"2025-07-11T09:32:12.885Z","repository":{"id":9704374,"uuid":"11655683","full_name":"CleverCloud/django-example","owner":"CleverCloud","description":"Run Django on Clever Cloud","archived":false,"fork":true,"pushed_at":"2024-04-23T16:35:03.000Z","size":22,"stargazers_count":3,"open_issues_count":0,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-25T12:01:11.705Z","etag":null,"topics":["clevercloud-example","django","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mekza/cc_django","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleverCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-25T08:27:40.000Z","updated_at":"2024-08-25T12:01:11.706Z","dependencies_parsed_at":"2023-01-16T19:45:45.695Z","dependency_job_id":null,"html_url":"https://github.com/CleverCloud/django-example","commit_stats":null,"previous_names":["clevercloud/demo-django"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fdjango-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fdjango-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fdjango-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fdjango-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleverCloud","download_url":"https://codeload.github.com/CleverCloud/django-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225712491,"owners_count":17512410,"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":["clevercloud-example","django","python"],"created_at":"2024-08-04T17:00:50.372Z","updated_at":"2024-11-21T10:30:23.742Z","avatar_url":"https://github.com/CleverCloud.png","language":"Python","funding_links":[],"categories":["Examples"],"sub_categories":["Python"],"readme":"# Clever Coud Django project\n\nThis project allows you to quickly begin a Django project on Clever Cloud.\n\n## Pre-requisites\n\nA working version of Python. This project has been tested on Python 3.11+ with Django 5.0.4.\n\n### Database\n\nBy default, Django will use a local sqlite database that won't persist between deployments. So you need to choose a non-local technology.\n\nDjango supports [some DBs](https://docs.djangoproject.com/en/2.1/ref/settings/#databases) and Clever Cloud can host somes as [add-ons](https://developers.clever-cloud.com/doc/addons/).\nTo keep it simple, you can run it either on MySQL or PostgreSQL. Add the suitable dependancy to `requirements.txt` according to your DB.\n\nFor local work, you can grab [PostgreSQL](https://www.postgresql.org/download/) easily; or [MySQL](https://dev.mysql.com/downloads/) and its compatible alternative [MariaDB](https://downloads.mariadb.org/).\n\n## Project creation\n\nFirst you need to [fork](https://help.github.com/articles/fork-a-repo/) the project or [duplicate it](https://help.github.com/articles/duplicating-a-repository/).\n\nIf you want to use a database such as PostgreSQL, refer to the [offical Django documention](https://docs.djangoproject.com/en/5.0/ref/databases/).\n\n## Clever Tools connect\n\nThis tutorial will use the [Clever Tools CLI](https://developers.clever-cloud.com/doc/cli/getting_started/).\n\nIt will allow you to create, configure and deploy your application on Clever Cloud from console.\n\nIn the following steps, we will suppose that you name (adapt to your needs) in the Clever Cloud dashboard :\n\n* your application : `django-cc` \n* your corresponding database add-on if needed : `django-cc-pg` (for example)\n\n### Create the app and add-on\n\nAt the root of the project :\n\n```bash\nclever login\n```\n\nLog in the UI and close it. Then create your Python application and PostgreSQL add-on :\n\n```bash\nclever create --type python --region par django-cc\nclever addon create --region eu --plan dev --link django-cc postgresql-addon django-cc-pg\n```\n\nMore information on parameters [HERE](https://www.clever-cloud.com/doc/clever-tools/create/).\n\nIf needed, you can set the scaling :\n\n```bash\nclever scale --min-flavor pico --max-flavor pico\nclever scale --min-instances 1 --max-instances 1\n```\n\nMore information on scaling [HERE](https://www.clever-cloud.com/doc/clever-tools/manage/).\n\n### Environment setup\n\nYou need to setup some Environment variables accordingly to your `settings.py` :\n\n```bash\nclever env set CC_PYTHON_VERSION \"3\"\nclever env set CC_PYTHON_MODULE \"ccdjangodemo.wsgi:application\"\nclever env set STATIC_FILES_PATH \"static/\"\nclever env set STATIC_URL_PREFIX \"/static\"\n```\n\nMore information on Python environement variables [HERE](https://www.clever-cloud.com/doc/python/python_apps/).\n\nOnce deployed, from the Console, your environement variables will look like that on **Expert** mode:\n\n```bash\nCC_PYTHON_VERSION=\"3\"\nCC_PYTHON_MODULE=\"ccdjangodemo.wsgi:application\"\nSTATIC_FILES_PATH=\"static/\"\nSTATIC_URL_PREFIX=\"/static\"\n```\n\n### Deploy !\n\nNothing else left to do, just go on and deploy your app :\n\n```bash\nclever deploy\n```\n\nNote :\n\nIf deployement failed with some error like : \n\n```bash\ndjango.db.utils.OperationalError: could not translate host name \"XXXXXXXXXX-postgresql.services.clever-cloud.com\" to address: Name or service not known\n```\n\nIt only means that you deployed too quickly after creating the PG add-on and name propagation has not yet been done. Wait a bit and try again later.\n\n### URL\n\nYour application automatically has a domain pointing to it. You can obtain it though :\n\n```bash\nclever domain\n```\n\nTo add other domains, more information [HERE](https://developers.clever-cloud.com/doc/administrate/domain-names/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCleverCloud%2Fdjango-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCleverCloud%2Fdjango-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCleverCloud%2Fdjango-example/lists"}