简体   繁体   中英

Deploying django project in cloudfoundry

I am new to django. I have a django project with multiple application. My project name is: DCMS_API. Procfile web: gunicorn DCMS_API.wsgi:application My manifest.yml:

---
applications:
- name: facility
  path: ./facility
- name: connect_DB
  path: ./connect_DB

buildpacks:
- https://github.com/cloudfoundry/apt-buildpack.git
- https://github.com/cloudfoundry/python-buildpack.git
env:
  ACCEPT_EULA: Y

i am trying to host it in cloudfoundry. i am uploading using following commands:

cf login -a ****.com -u ***@***.com -o DJANGO
cf target -s Development 
cf push

But in cloudfoundry it is hosting as multiple applications different URL. facility.*****.com & connect_DB.*****.com

How do we add a single project? like *****.com/facility & *****.com/connect_DB

Not sure how to put it as. giving a same domain name/ URL, just adding the application name at the end rather than hosting 2 separate application or hosting the project.

Sorry, I'm not totally sure what you're asking here, but it sounds like you want to use different routes, possibly routes where the subdomain is the same but the path is different. That's totally possible. You just need to map routes to your app instead of relying on the defaults. The default is to use a subdomain per app with the app name as the hostname of the subdomain and you have two different apps so you end up with two different subdomains for your app.

If you want to use routes, just adjust your manifest.yml file like this:

---
applications:
- name: facility
  path: ./facility
  routes:
  - route: example.com/facility
- name: connect_DB
  path: ./connect_DB
  routes:
  - route: example.com/connect_DB

buildpacks:
- https://github.com/cloudfoundry/apt-buildpack.git
- https://github.com/cloudfoundry/python-buildpack.git
env:
  ACCEPT_EULA: Y

Docs for setting routes: https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#routes and https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM