Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Devin Scheu
Devin Scheu
66,191 Points

Uploading a Python App To a Website

Im following along in Kenneth Love's flask course but I want to see my results, sadly workspaces is not working. So I was wondering if I could upload the file to my host gator domain and if so, is there any special thing i need to bring into my domain to get it to work, or do the files work on there own. Ive never really applied my code outside of workspaces or a local environment. Besides using wordpress.

2 Answers

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Devin.

It is said that python takes a little extra setting up in order for it to work on the web. Kenneth recommends heroku and I am developing on it at the moment, it matches very nicely with git - github and in a few steps you are up and running and files are actually host on github, so your app should be free (at least at the beginning, when it does not require much memory).

I had a quick look at the gator offers/documentation and python should run smoothly there as well and without an account upgrade (like on godaddy).

As far as I understand python needs 1/2 custom extra scripts or commands in order to actually run on the host, because if you just put the .py files there you will get thei plain text displayed.

I found this, which really looks helpful in this case: http://forums.hostgator.com/running-python-script-t138667.html

you may want to read it, it is a few lines only and should do the trick.

Let me know if it works, I am very interested in this.

Vittorio

Devin Scheu
Devin Scheu
66,191 Points

Hello Vittorio, thanks for the reply! It doesn't seem to wok, yet. I'm going to take a few screen shots of my layout and post them up for you.

Devin Scheu
Devin Scheu
66,191 Points

Here's a pic of my files, and here's a pic of the files inside the templates folder.

http://i59.tinypic.com/30c6tt0.png

http://i59.tinypic.com/e9az2x.png

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hey.

What is inside the .htaccess file?

To be honest what I would first try to do is trying to run a very simple python script.

So what I would do is remove all this files that you have at at the end of the course and that we have uploaded.

Let's say we create a .py file with a function that just return "things works" and with the function call.

Then I will only upload this and try to make things work running this simple script only, to see if we comunicate with their python interpreter or if we need extra settings.

Are the files in a subdirectory in the public_html folder?

Also, what do you mean it does not seem to work? What do you get? Some error message or you see the plain text of the files when visiting the right url?