Recs on getting started with Django on Heroku, with Pycharm - python

I've been trying for a couple of days to get my first Django app up on Heroku, mainly following Heroku's instructions (https://devcenter.heroku.com/articles/getting-started-with-django — 
(The background: for those interested, I'm a Django newbie who's created his first app and I thought I'd put it online to show it off as part of my portfolio. Not so easy! My shared-hosting web host said: nothing doing. So I looked through various things and came on Heroku, which is a bit pricey for me to use as a web host, but at least I could practice deployment.)
But I'm having a great deal of trouble. I deinstalled my regular pythons and installed homebrew and all that, finally got Pycharm to play nicely with my Homebrew python, but can't get gunicorn to work within Pycharm, can't get foreman to work as it can't find gunicorn (although gunicorn is installed into Pycharm's virtual env), etc.
I know both that I don't have a lot of idea what I'm doing (I'm still trying to grok Django) and that it would be difficult for anyone to troubleshoot my situation. I'm curious to know if anyone can suggest a step-by-step — taking the Heroku link as a starting point up until where it says to run foreman — that I could follow to proceed. A link would be super-helpful. I'm a good programmer, but really haven't tackled all these setup intricacies before, or deal with WSGI issues or anything like that).
Thanks, I know it's a bit vague, but I'm a bit blinded by the light at the moment.

This may not be quite the answer you're looking for, but if you come over and give us a try at PythonAnyhwere.com, we specialise in Python hosting, we provide lots of instructions on how to get going with django, and are very happy to help you if you run into any problems....

Related

Deploy python flask project into a website

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.

Sharing of various Django setup guides [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
This may be a little clean and green, however when I try to explain my setup to a rubber duck, many times I awake to find myself in a pile of my own hair and the duck still there, staring at me emotionlessly. thats when I knew it was time to escalate the matter to SO.
What frustrated me was, initially when I follow a guide that I think looks credible, install virtualenv etc etc, and following which, started my hello world project. And while researching on a webserver I was faced with the apache2 vs gunicorn dilema, I figured ok lets use gunicorn. Didn't think too much and got started with another Hello World app, then I realised that I missed out version control and created another hello world project and I am here biting on my nails and eating my hair as I found that I may have likely messed up the file system folder structure and convention, and here I am creating my forth django hello world app.
Someone save me from bootstrap hell.
OS: ubuntu 12.04 server lts
db: MySQl
Framework: Django
Background: To create a reporting app with utilises d3.js
facts: This project will not use PaaS
how I went about doing it,
installed easyinstall
installed pip
installed django ( pip install gunicorn django )
installed gunicorn
setup nginx
started django project (cmd: startproject, runproject)
----- here is the part where things get fuzzy -----
installing git???
installing django-south?
adding h5bp (to-do)
Would appreciate to know if I am doing this in the right order OR any other clear guides for setting up django
This is a difficult question to answer because its more about opinions than anything else; and everyone works a different way. However, if you understand the reason behind the recommendations, then you will be better prepared to judge other bootstrapping scripts and - even better - build your own that does what you want.
Here are things you need to ensure are taken care of.
Isolate your development packages from your system-wide Python install. Use virtual environments to accomplish this. Further, you should make sure you pin your packages so that you don't get surprises when versions are upgraded.
Use any form of version control. It doesn't have to be git. You don't need to use github.com. Use mercurial, cvs, bazaar or whatever else. The important part is you use something. So find out what works for you and get going.
For development, do not even bother with a web server. Django comes with a webserver that you should use during development. Run it with python manage.py runserver. When you are finished with your development, you should deploy any web server that supports wsgi. The documentation provides deployment guides that can help you with this.
Everyone and their dog has a recommendation for folder layout and structure. The problem is, each have their own reasons for recommending it. If you do not understand why you will only get frustrated with the layout. So, my suggestion is start with the standard layout that comes with django. The only thing I would add is that you create a docs/ directory where you stick any/all documentation for your project; and a requirements/ directory where you save all your requirements files and keep both of those updated.
Finally, some of my suggestions.
Use postgresql unless you have a compelling reason to go with mysql. postgresql works best with django and some ORM features (like using distinct on columns) only work with postgresql.
Keep your templates and views simple. Instead of cramming a lot of logic in the views, create other python modules that you can import. This will make your project easy to extend (for example, if you want to create an API). Your templates should have absolutely the minimal amount of logic. If you use custom template tags, make them as simple as possible because they are difficult to debug.
Don't be afraid of creating custom model managers and other tricks in the ORM. There is a lot of stuff you can do there that will make your application easier to develop.
django-south is recommended, but make sure you understand how it impacts your projects before you install it; otherwise you'll just end up after a few iterations with a migration that won't run - then you'll either spend a good amount of your time trying to fix the migrations, or simply dropping the database and starting over.
Found this great resource which was almost exactly what I am looking for.
epicserv updated 2013
https://gist.github.com/epicserve/1332256 (updated 2013)
senko updated 2011
http://senko.net/en/django-nginx-gunicorn/

Whats the recipe for a safe enviroment to create/play with my web applications.

How can i create a safe environment to create new and play with my web applications?
My ingredients so far: python,flask,github,heroku --- I have effectively created a app using flask and heroku (it just says hello world)
I have some knowledge of python. Have read through but hardly understand the flaskr tutorial for Flask. I do however envision that i'm going to be very frustrated if i can't have some kind of version history of my stumblings.
Without being sure i feel like the recipe might include: Github and virtualenv and some coping pasting of directories...
whats a recommended way to do this?
Just setup a GitHub repository and start hacking away with Flask.
Some pointers:
Use SQLAlchemy for database operations. It's secure and easy to use.
Either dive right into your project or make some simple test ones with Flask. It's a really beautiful framework to work with and is easy to learn, so just try to accomplish some simple tasks and get used to how it works.
I suggest you to use virtualenv and virtualenvwrapper, this way you can work on isolated pythons without filling your system's python with many eggs and switch between them easily.

How to install (run) Jumo (Python/Django) on localhost

I am trying to run Jumo open source platform ( https://github.com/jumoconnect/openjumo) on my local machine (Windows 7). I have Python and Django installed and it works - I can create new project without problems, but I am not sure how to set existing project and make it work.
I am not experienced with Python/Django, so first I need to know whether it is hard task or not. I guess it's much complicated then installing WordPress or Joomla, but does that require a lot of work in order to set it up?
Can someone write some kind of guide if it is not too complicated? Or if there is some tutorial that explains how to do that, that would be great.
Just to be clear, I am not trying to learn something in one day, just want to see if this first step in using this platform is too hard, and if it's not, I'd continue learning, because this is exactly what I need for one project.
I use Python 2.7 and Django 1.3.1
Thanks
This project has a lot of external requirements which are not listed anywhere and unless you are comfortable and familiar with django, I wouldn't recommend installing it. Here are some but not all of the requirements that you'll need running:
Celery and django-celery
RabbitMQ (a broker for Celery), or another broker but then you'll have to edit settings.py again.
memcached (this is optional, as you can use django's own session middleware for development), but if you simply download the code and try to run it, you'll run into an error since the default settings.py has the default middleware commented out.
grappelli
django-jenkins (not required, but again, unless you edit the default settings.py, you'll get errors).
django-tastypie
django-debug-toolbar
Data science toolkit server
as you may know Django is a powerful web framework and Python is a programming language, for python itself you need more than a few months to become some kind of expert.
it's very easy to start, but not that easy to learn the whole stuff. Django is one of the most or maybe the most powerful web frameworks (beside Ruby on Rails).
my advice to you:
learn python's basics (there's many books such as dive into python,
...)
learn Django basics (Django Book)
use Django on a Gnu/Linux (for example Ubuntu)
learning basics of Django can be done in a few weeks.
consider deploying a Django website is not that easy. you need to know a little about Apache web server.
www.djangoproject.com
note that in python (like other programming languages) you need to define working path. errors mentioned in question's comments usually caused by this.
also you should check Python installation path. sometimes these kinds of errors occurs when there is a project with the same name as yours in python installation path.

django one click deploy to dreamhost

I have a python/django application that im running on my dreamhost account. Excuse me for the novice question, but I'm a Java programmer by day and relatively new to python.
Ideally what I'd like to do is set something up where I can take the code I have locally, upload it to my server and then touch the restart.txt file. I realize I could probably accomplish this with a bat/ftp script, but I has hoping for something a bit more advanced/robust. I have a local mercurial repository where I'm doing version control, is it at all feasible to get mercurial running on dreamhost, and then set up so that when I push changes from my local repo to the server repo, those get deployed to the proper location?
Are there other solutions I should be looking at? I guess all I'm looking for is someone to point me in the right direction.
All the cool guys are using fabric nowadays. It's exactly what you looking for.

Categories

Resources