0

I've tried to find a concrete answer for this but failed. I'm rather new to openshift, django and git so I hope it's not too trivial and not a duplicate.

The situation is as follows: 1. I'm developing a Django based web application and source control it using git on a private bitbucket repo. I have my regular django application source tree as needed. 2. I wish to deploy my app on openshift which comes with a different directory tree. I've been able to successfully run this quickstart: git://github.com/rancavil/django-openshift-quickstart.git

Basically what I try to achieve is a wrapper directory (and git project) which is based on the repo specified in #2. Within this wrapper one of the subdirectories (wsgi/my_project) should be based on my private repo specified in #1. I wish to be able to pull recent changes from the private repo and then push and deploy to openshift these changes.

Any help would be greatly appreciated!

Zulu
  • 8,765
  • 9
  • 49
  • 56
sivanr
  • 477
  • 5
  • 10

1 Answers1

0

I was also struggling with openshift structure. But there is no need for doing the staff like you have proposed.

You can have any structure of a project you want. Openshift will need just wsgi/application or wsgi.py as an entry point. I think that having one more file in your project is hardly a problem.

My current structure for a project (got it running recently) is following:

|- .openshift (directory for build and deployment hooks like syncdb or collectstatic commands)
|- custom_project (directory that is you django project)
  \- templates
  |- settings.py
  |- urls.py
|- manage.py
|- requirements.txt
|- wsgi.py

There is really no need to have project under wsgi folder. However there are few more pitfalls to be aware of. Like creating static folder or setting .htaccess for static files.

Including my wsgi.py:

#!/usr/bin/python
import os
import logging
try:
    virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
    virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
    execfile(virtualenv, dict(__file__=virtualenv))
except (IOError, KeyError):
    pass

os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'custom_project.settings')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

I have used a lot of resources to make my project running on openshift so I'm also including them for other.

Community
  • 1
  • 1
darkless
  • 1,304
  • 11
  • 19