Is possible to deploy a django app with daphne, and postgress manage database, and a redis manage database, direct form github automaticly?

Or I should deploy with docker?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

👋 @djjordisoley

You can definitely deploy a Django app with Daphne by pointing it at your GitHub repository.

During the setup you will need to configure your environment variables and required databases, after that’s done you can deploy automatically with every code merge or manually with the deploy button.

App Platform can create a dev Postgres instance for you which can be upgraded to production grade later on if necessary. You’ll have to pre-create the Redis server in our Managed Databases section.

Here’s an example spec of a Django app that has a Redis and Postgres DB connected to it:

name: sample-django
region: nyc
- environment_slug: python
    scope: RUN_TIME
    value: ${my-postgres.DATABASE_URL}
  - key: REDIS_URL
    scope: RUN_TIME
    value: ${my-redis.DATABASE_URL}
    branch: main
    deploy_on_push: true
    repo: digitalocean/sample-django
  http_port: 8080
  instance_count: 1
  instance_size_slug: basic-xxs
  name: sample-django
  - path: /
  run_command: gunicorn --worker-tmp-dir /dev/shm
- cluster_name: my-redis
  engine: REDIS
  name: my-redis
  production: true
  version: "5"
- cluster_name: my-postgres
  engine: PG
  name: my-postgres
  production: true
  version: "12"

You can find this spec in your app/settings/view spec area.

  • Hello,

    I have tried different github repros and always I get the error: App detection failed
    We’re sorry, but we weren’t able to detect anything that the App Platform can currently run in the repository you selected. Please try a different repository.

    Any other way to configure?

    • Hmmmm 🤔

      If you structure your apps so the files we detect are not in the root of the directory (eg. requirements.txt in the root of the repo) that could be the issue.

      This is where the flexibility of deploying with a dockerfile comes in to play. Here are some docs to help you with this:

      Note, currently we can’t deploy dockerfile based apps from the UI so the CLI tool (doctl is required).

      If you want support specific to your app, you can open a support ticket.

      • Yep, I had a typing error in requirements.

        This is the command that I use.

        daphne -b -p 8080 {{mynameapp}}.asgi:application

        But my app is not able to get my current static files. I have to set up and static site?