I'm a newbie and learning Heroku systems. I want to run this CMS on Heroku. I ran it many times on my machine and on others' servers. But I don't have servers all the time. I want to make it on Heroku for contestants.
As always I tried to follow the docs of this app. The requirements and setup part runs fine. But the database creation and other parts I couldn't cope up with. As a result, it shows an application error. The app also uses Postgres. But the commands given for ubuntu, I don't know how I can make them in Heroku.
If it sounds stupid question please pardon me. If I have to learn about something please give me some resources to learn.
Or It it is not possible to run this app with heroku, is there any SSH tunelling trick to just make the contestant part online with heroku Or is there any way to just tunnel my localhost to heroku web app domain? Thank You Very Much.
Related
Dear Stack Overflow Members,
Wish you a nice and healthy day.
I am working on a small project in which several Python Bokeh web applications are going to be run/served by a Flask app.
In short, the app in this (https://abouttest.herokuapp.com/about) link is supposed to work under the line in this app (https://tflasktest2.herokuapp.com/). I manage to have these work locally. First; I open a terminal window locally and enter this command:
bokeh serve name_of_my_bokeh_server_file.py --allow-websocket-origin=127.0.0.1:5000 ;
second I open another terminal and enter:
python my_flask_file.py
and then simply go to my 127....:5000 page to see the two apps running.
How can I manage this under Heroku? I think I need to update the Procfile but my many trials did not solve the problem. Both files are also running separately on Heroku but I could not manage merging them as I do that locally.
I really appreciate your assistance on this.
Kind Regards.
Tansu Baktıran
So I recently finished my python project, grabbing values from an API and put it into my website.
Now I have no clue how I actually start the website (finding a host) and making it accessible to other people, I thought turning to here might find the solution.
I have done a good amount of research, tried "pythonanywhere" and "google app engine" but seem to not really find a solution.
I was hoping to be able to use "hostinger" as a host, as they have a good price and a good host. Contacted them but they said that they couldn't, though I could upload it to a VPS (which they have). Would it work for me to upload my files to this VPS and therefor get it to a website? or should I use another host?
I just deployed my first app and used Heroku. I'm very happy with it so far and it was fairly straight forward to set up. It does require a basic git understanding but was not hard to learn
A VPS would work, but you'll need to understand basic linux server admin to get things setup properly.
Sounds like you don't have any experience with server admin, so something like App Engine would be great for you. There are a ton of tutorials on the internet for deploying flask to GAE.
I'm currently learning Django and getting a decent grasp of it. I know you can start the server with python manage.py runserver. But then there is also heroku ps:scale web=1 followed by heroku open to open the web page at the subdomain you chose on the host herokuapp.com. What is the point of using heroku vs just runserver? When it comes time to deploy to production is that what heroku is used for as I read it was for deployment? What is exactly is heroku used for and what are the reasons? When creating a professional django web site/application is heroku required or just very useful? If so why? I don't really understand the reason for using heroku. And I'm curious what the best practices are for django and whether they include using or not using heroku.
Aside from the heroku question, what are the best practices for django as far as setting a domain name and such (other than the herokuapp.com subdomain name) and also as far as what other components/software solutions are worth using with django?
One of the things I'm working on is an FTP portal on the website that people can login to and upload files. Does django have plugins/python modules for such a thing or must it be done custom? Which brings me to my final question, What kind of addons/modules does django offer to avoid reinventing the wheel when implementing a django website/app's certain features?
The tutorial I'm following: http://tutorial.djangogirls.org/en/django_orm/README.html
has helped me get a grasp on django, but I'm curious about the more advanced parts of it. Such as custom modules, custom styling, custom scripts (whether they are js or strictly python).
If someone could point me in the right direction or offer any suggestions it would be much appreciated. The tutorial has me using the modules: dj-database-url, whitenoise, gunicorn, python-dateutil, psycopg2 , requests. I know what some of them do, but what is the purpose of psycopg2, whitenoise, dateutil, and dj-database,url? Are there any other modules worth using?
Sorry for the wall of questions, but I'm trying to understand django as best I can so that I can do a correct assessment when putting together a django project.
Thanks in advance.
EDIT, final questions:
1) Also when i used heroku they gave me a subdomain at herokuapps.com Can I set my own URL and still use heroku?
2) And last but not least, heroku makes you register and gives you a subdomain on herokuapp.com Is there a way to use heroku with your own domain rather than the one they give you? Is there a specific way to do it?
EDIT 2:
When I do runserver it works fine, but when i run it with heroku ps:scale web=1 and then heroku open it opens but only shows the title at the top of the page, and no content. Not sure exactly why that is. Can someone explain the difference between runserver and heroku ps:scale web=1 followed by heroku open??
python manage.py runserver is only for development. Never use it in production.
Heroku makes it super easy to deploy your Django code. You only need some configs and git push heroku master. But it's not the only way to deploy your code. You can also set up a server with a webserver like Nginx, Gunicorn as WSGI server, and a database of your choice. To set things up, you need to know something about Linux and the command line.
So if you don't know how to set up a server, Heroku can be very useful.
Heroku supports custom domains, and it's easy to set up.
As Mikeec3 mentioned, "Two Scoops of Django" is a very good read.
If you are looking for django packages, www.djangopackages.com is a good place to start.
psycopg2 is for postgresql usage with your app. White noise allows you to serve your staticfiles without nginx if using gunicorn. Requests is an easy to use urllib2 library with pythonic calls to work with apis from other websites.
If you want to do some testing with say facebook logins Heroku is a great place to go to, especially if you need a url outside of localhost.
My suggestion is you read Two scoops of Django http://twoscoopspress.org/products/two-scoops-of-django-1-6
It goes over alot of best practices and serves as a great tutorial after polls. I suggest also incorporating django-bower into your project. Ill list a few great things to add.
Django Bower: https://github.com/nvbn/django-bower - Helps organize static files
Crispy Forms : https://github.com/maraujop/django-crispy-forms - Great form rendering, great with bootstrap
Django Rest Framework: https://github.com/tomchristie/django-rest-framework - REST APIs
These are just to start, there's alot to learn.
I have been having some problems with deploying my django app to heroku. I have triple checked the getting started guide several times and I am getting quite frustrated. The most annoying thing is that I don't get any errors during deployment, in heroku logs or during local deployment. Here is an SO question with more details.
The easiest solution at this stage would probably be to reverse engineer a minimal working django app which I could push straight to my heroku repo without any extra config.
(The smaller the app the better a simple <h1>hello world</h1> would do but it would need to include venv, requirements.txt and of course Procfile)
Thanks
Take your pick. Either of these should work for you.
https://github.com/auzigog/django-template-heroku
https://github.com/cyberdelia/django-heroku-template
You can try http://django.ironcoder.me - visual composer, which deploys working Django app to your heroku account.
I'm looking for a hosting service to run my python scripts. My python scripts take info from various API's and put them into a Mongo database. I'd like to schedule them so that they run once an hour. Right now I'm running python 2.6 and using a couple of extra packages like facebook sdk and python twitter tools. I've been looking into heroku, but I'm new to the service and I'm having trouble finding documentation on heroku and python. The other service that I came across is MongoHQ, but I'm unsure as to how that works with Python. Do you know of a hosting service that would be compatible with all of these things?
EDIT
I took the advice below and explored DotCloud a bit. For anybody who's a newb like I am, I wrote a post on it on my blog (swootsblog.cloudfoundry.com) which I hope is pretty easy to follow along with. It's a continuously running python script writing to a MongoDB all set up on DotCloud.
Heroku doesn't run Python, they only run Ruby, Node.js, Clojure and Java.
There might be other services, but I've played around with DotCloud which has a python worker type for exactly this sort of work.
Heroku Does runs python scripts, I have previously done this with python to postgres database,
Pre-req
pythonscripts.py
procfile
requirements.txt
and After add, commit and push the scripts to heroku app. Just run the following command on terminal to run the scripts.
heroku run python your_scripts.py
More if you want to run this scripts on a schedule timing. then heroku provides lots of adds-on. just search it on heroku
If you need more help, make a chat with me.