0

I have a working Django application in my local machine. I tried hosting this application in Openshift, after following the Openshift official tutorial didn't get any results. Is there any proper resource to deploy local Django applications to openshift

Navajyoth M S
  • 426
  • 3
  • 11

1 Answers1

0

On Openshift you can deploy Django applications using either the Django cartridge or the Python cartridge. Using the Python cartridge is often preferred as it enables you to easily install the latest version of Django using pip.

Are you using the Django or Python cartridge?

To use the Python cartridge you can follow this tutorial: https://developers.openshift.com/en/python-getting-started.html

You mention that you already have a django application on your local machine. It can be a bit tricky to push an existing project to openshift.

If you create the application using the Python cartridge it will create a git repository for you that you then clone onto your computer. Using the website find the URI for your application repository. You should clone this onto your computer into a separate directory from your existing django project. Look into this new repository and copy the files from that repository into your existing repository. Then you can look at the remote location used in this new repository and set it as a remote in your existing django repository. Then from your existing repository push to the openshift remote using the --force flag.

$ cd /home/user    
$ git clone ssh://<user_id_string>@python-yourdomain.rhcloud.com/~/git/python.git/
$ cd python
$ tree .   # look at the files in the repository (wsgi.py, etc.)
$ <copy the needed files to your django dir>
$ cd ../<existing_django_dir>
$ git remote add openshift ssh://<user_id_string>@python-yourdomain.rhcloud.com/~/git/python.git/
$ git push -f openshift master

Directions on force push: Force "git push" to overwrite remote files

Community
  • 1
  • 1
Noah
  • 1,683
  • 14
  • 19