Question

Django + React App Deployment using App Platform in one App

Posted July 9, 2021 354 views
PythonPostgreSQLDjangoPython FrameworksDevelopmentReactDigitalOcean App Platform

Hello,
I’m building a web application based on Django + react in one project (Single Repo) with backend and frontend folder in it, when I tried to deploy repo which have both app it’s not deploying in Digital Ocean App platform and getting error that Repository not found. So how can I deploy one repo app (Backend (Django) + frontend (React)) on Digital Ocean App Platform.
I could see there is solution to deploy both app as separate, but looking for solution if I can deploy single app through App platform?

Thanks in advance!

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 @UpgradeYourLogic,

The error Repository not found states that our build system did not find any files to build the app. From your description, it appears there are multiple folders(backend + frontend) in your repo which would be used for deployment. You should use the Source Directory option to choose the appropriate folder while deploying the app. You could first deploy the frontend and then add the backend as a component to the app in a similar fashion.

You could refer the mentioned link for the same.

In case you still see issues, please feel free to reach out to our Support team and we would be glad to help you out!

Cheers,
Taha Fatima

  • Thanks Taha for the information!

    As suggested by you I have tried to deploy first frontend folder with default directory option but still I’m getting same error, App platform not detecting react app when I give the frontend folder as source directory.

    Below is the my GitHub Repo Structure:

    Repo Name
    – main
    —- backend (Django + Python Server App)
    —- frontend (React App)
    —- README.md
    —- .DS_Store

    Question: Do we need to have package.json file out of frontend folder?
    Question: Gone through the resources that you provided but commands not looks like related to react / npm, so do we have something different process for react app?

    Appreciate your help.

    • Thanks GLogic
    • Hi @UpgradeYourLogic,

      Please find the answers to your queries inline:

      Question: Do we need to have package.json file out of frontend folder?

      -> No, you do not need to have the package.json outside of the frontend folder. If you are passing frontend as the Source Directory while deploying the app, the package.json has to be present in the frontend folder.

      Question: Gone through the resources that you provided but commands not looks like related to react / npm, so do we have something different process for react app?

      -> To build a react app, you need to have the package.json in the specified Source Directory. We have a sample react app and you could refer the same.

      In case you still have issues, I’d request you to raise a support ticket with us so that we could have a direct visibility of what’s happening and it would be easier to identify the root cause of the issue.

      Cheers,
      Taha Fatima