What are the localhost URLs for OpenShift hosted Django apps - django

I created a Django application locally and then using the django openshift template from
here I uploaded it to OpenShift successfully. Now I'm trying to work on the local repository for adding additional features but when I run the server locally, I get a bad url error.
What I would like to know is how do I locally host a OpenShift Django App?
I also tried rhc tail -a appname but that only gets me a small amount of debug info If I can't locally host it then is there a way with which I can see the python print() output for the app hosted on OpenShift?

Related

Heroku set default site

I have created a new Heroku site and I am developing it on my Linux box, using Django. The standard "getting started" site Heroku created for me is called "gettingstarted". How can I change that / configure Heroku to forget about it?
I was reading through the Django tutorial, which explains how to create a new site (django-admin startproject my_site). I did this successfully for a demo project. Then I tried to do it under the Heroku directory, because I wanted a better name for my site than "gettingstarted". I noticed that every time I start the Heroku server under my project, it says ...using settings 'gettingstarted.settings'. I found that this is configured in manage.py and I change it.
This is the directory layout I have
/some/path/heroku_random_name/gettingstarted/settings.py
/some/path/heroku_random_name/my_site/settings.py
/some/path/heroku_random_name/my_app
This is what I have in
/some/path/heroku_random_name/manage.py
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_site.settings')
so I would expect that the site that matters is my_site.
I got it to the point where I can run the site successfully on my local machine, and I can tell that it using the settings from my_site. But when I deploy the project to Heroku, it does not recognize my_app until I register it in gettingstarted/settings.py. In other words, when running in Heroku, it is still using gettingstarted as the site to run.
I am new to all this, so I left gettingstarted in the project, because I am afraid to break things. But how can I configure Heroku to execute settings from my_site and not from gettingstarted?
Found it: it's configured in Procfile.
It's confusing because it's configured in one place for running locally and in a different place for running hosted at Heroku.

Django Cookiecutter Production Server Setup on DigitalOcean

I am trying to setup my Django Cookiecutter code on an Ubuntu server hosted on Digital Ocean. (My first attempt at such a thing.)
It does not appear that my .env file is loading?
DATABASE_URL=postgres://myapp:pwd123#127.0.0.1:5432/myapp
DJANGO_ALLOWED_HOSTS=187.99.73.187,myapp.com,187.99.73.187:8000
DJANGO_ADMIN_URL=admin
DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=A8fpfkN5}...m5~^jggSo3wq`0Z*
I am using the latest version of Cookiecutter. https://github.com/pydanny/cookiecutter-django
Do I have to do something special to activate/recognize this code?
Right now I am getting an error of add '187.99.73.187' to ALLOWED_HOSTS. But it is in the env file.
I also had Postgres error based on not getting data from this new .env file.
I see instructions and videos for setting up Cookiecutter on Docker, Heroku and PythonAnywhere. Just not for a simple Linux installation.
Thanks.

After deploying django in AWS EB its not working similarly as it runs in localhost

This is how Admin page works in local host
This is how its showing after deploying in AWS EB
can i get help on this like how to get it normal or how to modify it using my own templates please .
In development django itself serves the files, which is not scalable in production, and thus requires you to collect your static files as documented here and serve them using your proxy server.
You can read about how collect static files in django on Elasticbeanstalk here
Before deploying run : python manage.py collectstatic
After running this you should deploy again like you usually do.

Yowsup working on normal EC2 instance but not on Heroku

I have developed a micro-service in django to access the yowsup2 library for whatsapp.
Everything works fine on my local environment with the procfile configured correctly.
web: gunicorn XXXXX.wsgi --workers=1
After I configured it on heroku.
heroku local
also works correctly.
But when I pushed the code to heroku server.
The initialisation code for yowsup gets stuck on
storing prekeys 100%
After spending 4 hours I were not able to make it work on heroku.
So switched back to Amazon EC2 Instance and its working like charm on that.
Software stack:
Django
Gunicorn
yowsup2
Django Rest Framework
Any help on this would be appreciated.

Django: Testing locally before pushing app to Heroku

I've followed the instructions from Heroku's "Getting Started with Django", and successfully deployed my application on the Heroku server.
However, there wasn't any tutorial on how to test my application locally before committing and pushing any change on my codes. For example, after I make some minor changes on my css file or Django views, I want to test it on my local computer first, instead of having to do "git push heroku master" every time..
How do I do this with Heroku?
Thanks
To test your app locally you don't need to use Heroku. Simply go to the folder where your manage.py is and do:
python manage.py runserver
It will fire up a development web server with your app you can access using the following URL in your browser: http://localhost:8000.
This web server reloads automatically when you make changes to the Python code. See the Django tutorial: https://docs.djangoproject.com/en/1.7/intro/tutorial01/#the-development-server
Additionally, you might need to set some variables in your environment (export VARNAME=value) to make it work with 12-factor-style settings.