Question

Deploy a Django App on App Platform

Posted October 6, 2021 88 views
PythonDjangoPython FrameworksDevelopmentDigitalOcean App Platform

The deployment fails with this error when trying to install requirements


2021-10-06T18:03:59.720473494Z => Initializing build
2021-10-06T18:03:59.741010724Z => Retrieving source code to /workspace
2021-10-06T18:03:59.758849751Z => Selecting branch “main”
2021-10-06T18:04:00.159566742Z => Checking out commit “666c7e0ecd55fe5495b3cf4b466b822f82eb6c83”
2021-10-06T18:04:00.535764206Z => Got sourcedir: /
2021-10-06T18:04:00.553595240Z => Using workspace root /workspace
2021-10-06T18:04:00.583787726Z
2021-10-06T18:04:00.583894091Z => Building app using buildpacks
2021-10-06T18:04:00.726690445Z => Injecting app environment variables:
2021-10-06T18:04:00.726721849Z DJANGO
SECRETKEY DJANGOALLOWEDHOSTS DEBUG
2021-10-06T18:04:00.968871562Z => Running buildpack detection
2021-10-06T18:04:00.968922679Z
2021-10-06T18:04:01.182965122Z 3 of 4 buildpacks participating
2021-10-06T18:04:01.183077892Z digitalocean/python-appdetect 0.0.2
2021-10-06T18:04:01.183161500Z heroku/python 0.192.4
2021-10-06T18:04:01.183218425Z digitalocean/procfile 0.0.3
2021-10-06T18:04:01.238666259Z
2021-10-06T18:04:01.238807161Z For documentation on the buildpacks used to build your app, please see:
2021-10-06T18:04:01.239063612Z Python: https://do.co/apps-buildpack-python
2021-10-06T18:04:01.468634887Z
2021-10-06T18:04:01.469081066Z => Building app
2021-10-06T18:04:01.469631551Z
2021-10-06T18:04:02.264873958Z —–> Installing python-3.9.4
2021-10-06T18:04:05.434003564Z —–> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
2021-10-06T18:04:11.655215061Z —–> Installing SQLite3
2021-10-06T18:04:24.762658484Z rm: cannot remove ’/workspace/.heroku/python/apt/state/lists’: Directory not empty
2021-10-06T18:04:24.764190145Z Sqlite3 failed to install.
2021-10-06T18:04:24.944953367Z —–> Installing requirements with pip
2021-10-06T18:04:25.958222556Z Collecting asgiref==3.4.1
2021-10-06T18:04:25.993613638Z Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)
2021-10-06T18:04:26.041369300Z Collecting autopep8==1.5.5
2021-10-06T18:04:26.052029519Z Downloading autopep8-1.5.5-py2.py3-none-any.whl (44 kB)
2021-10-06T18:04:26.115587717Z Collecting brotlipy==0.7.0
2021-10-06T18:04:26.128663696Z Downloading brotlipy-0.7.0-cp39-cp39-manylinux1
x8664.whl (1.1 MB)
2021-10-06T18:04:26.224058551Z Collecting certifi==2021.5.30
2021-10-06T18:04:26.236715107Z Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
2021-10-06T18:04:26.268020785Z Processing /C:/ci/cffi
1625831756778/work
2021-10-06T18:04:26.293704846Z ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: ’/C:/ci/cffi_1625831756778/work’
2021-10-06T18:04:26.293726272Z

2021-10-06T18:04:26.466895464Z [31;1mERROR: [0mfailed to build: exit status 1
2021-10-06T18:04:28.016458258Z
2021-10-06T18:04:28.016494065Z For documentation on the buildpacks used to build your app, please see:
2021-10-06T18:04:28.016501548Z Python: https://do.co/apps-buildpack-python
2021-10-06T18:04:28.018683649Z
2021-10-06T18:04:28.019290063Z [31m ! Build failed (145)[0m

2 comments
  • Hey there!

    Looking through your output it looks like this may have been configured with a specific directory or file that can’t be found. Did you make any changes from the tutorial that could account for the C:/ci/cffi1625831756778/work directory?

  • The same issue happened with me!

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

Hi there,

It looks like that you have the /C:/ci/cffi_1625831756778/work hardcoded either in your environment variables or somewhere in your code. I would recommend adjusting this to be a relative path rather than an absolute one.

That way when you deploy your project to a different server rather than your local Windows PC, the path would not have to be adjusted.

Also as a side note, here is a very good tutorial on how to deploy Django to the App platform:

https://www.digitalocean.com/community/tutorials/how-to-deploy-django-to-app-platform

Let me know how it goes.
Best,
Bobby

by Mason Egger
Django is a powerful web framework that allows you to deploy your Python applications or websites. Django includes many features such as authentication, a custom database ORM, and an extensible plugin architecture. Django simplifies the complexities of web development, allowing you to focus on writing code. In this tutorial, you'll configure a Django project and deploy it to DigitalOcean's App Platform.
  • Well, I am using Conda as my development machine. So I updated the requirements.txt file in my GitHub to see how this proceeds and now I see an error in the Conda package. I will troubleshoot later when I am on my computer where I was trying this..

    However, it will help to see what is the requirement.txt file you have used when doing these deployments.


    2021-10-12 17:08:47] —–> Installing SQLite3
    [2021-10-12 17:09:06] rm: cannot remove ’/workspace/.heroku/python/apt/state/lists’: Directory not empty
    [2021-10-12 17:09:06] Sqlite3 failed to install.
    [2021-10-12 17:09:06] —–> Installing requirements with pip
    [2021-10-12 17:09:08] Collecting asgiref==3.4.1
    [2021-10-12 17:09:08] Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)
    [2021-10-12 17:09:08] Collecting autopep8==1.5.5
    [2021-10-12 17:09:08] Downloading autopep8-1.5.5-py2.py3-none-any.whl (44 kB)
    [2021-10-12 17:09:08] Collecting brotlipy==0.7.0
    [2021-10-12 17:09:08] Downloading brotlipy-0.7.0-cp39-cp39-manylinux1x8664.whl (1.1 MB)
    [2021-10-12 17:09:09] Collecting certifi==2021.5.30
    [2021-10-12 17:09:09] Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
    [2021-10-12 17:09:09] Collecting colorama==0.4.4
    [2021-10-12 17:09:09] Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
    [2021-10-12 17:09:09] ERROR: Could not find a version that satisfies the requirement conda==4.10.3 (from -r /workspace/requirements.txt (line 6)) (from versions: 3.0.6, 3.5.0, 3.7.0, 3.17.0, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.7, 4.0.8, 4.0.9, 4.1.2, 4.1.6, 4.2.6, 4.2.7, 4.3.13, 4.3.16)
    [2021-10-12 17:09:09] ERROR: No matching distribution found for conda==4.10.3 (from -r /workspace/requirements.txt (line 6))
    [2021-10-12 17:09:09] ERROR: failed to build: exit status 1
    [2021-10-12 17:09:12]
    [2021-10-12 17:09:12] For documentation on the buildpacks used to build your app, please see:
    [2021-10-12 17:09:12] Python: https://do.co/apps-buildpack-python
    [2021-10-12 17:09:12]
    [2021-10-12 17:09:12] ! Build failed (145)


    This is what I passed as a manual try to proceed in my requirement file.


    asgiref==3.4.1
    autopep8==1.5.5
    brotlipy==0.7.0
    certifi==2021.5.30
    colorama==0.4.4
    conda==4.10.3
    dj-database-url==0.5.0
    Django==3.2.8
    gunicorn==20.1.0
    isort==5.7.0
    lazy-object-proxy==1.4.3
    mccabe==0.6.1
    menuinst==1.4.16
    psycopg2-binary==2.9.1
    pycodestyle==2.6.0
    pycosat==0.6.3
    pytz==2021.3
    pywin32==228
    six==1.15.0
    sqlparse==0.4.2
    toml==0.10.2
    wincertstore==0.2
    wrapt==1.12.1