Forums

Noob question, how can I upload a page like this one?

I'm sorry I'm a total noob, I've been trying to upload this kind of page, which I got from a template provider, I plan to use Django but this is what we got for now, and we'd like to test it online in order upgrade to a startup package.

00:15 ~ $ ls  /var/www
404.html                    dark-style.css
__pycache__                 demos
about.html                  faqs.html
blog-single-audio.html      fonts
blog-single-fullwidth.html  html
blog-single-image.html      images
blog-single-no-media.html   index.html
blog-single-quote.html      ismaelvc1337_pythonanywhere_com_wsgi.py
blog-single-sidebar.html    ismaelvc1337_pythonanywhere_com_wsgi.py.2015-04-07-01-57.bak
blog-single-slider.html     ismaelvc1337_pythonanywhere_com_wsgi.py.2015-04-07-23-05.bak
blog-single-video.html      ismaelvc1337_pythonanywhere_com_wsgi.py.2015-04-08-00-03.bak
blog-three-columns.html     js
blog-timeline.html          page-fullwidth.html
blog-two-columns.html       page.html
blog-two-sidebar.html       pricing.html
blog.html                   royalslider
blogprox.html               rs-plugin
contact.html                service.html
contact.php                 sitemap.html
contact_podio.html          style2.css

I know I'm sorry! ...something is very wrong because of me! :P I'm starting to look into the Django template system, thanks in advance!

This is my wsgi file:

HELLO_WORLD = """<html>
<head>
    <title>Python Anywhere hosted web application</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>
    This is the default welcome page for a
    <a href="https://www.pythonanywhere.com/">PythonAnywhere</a>
    hosted web application.
</p>
<p>
    Find out more about how to configure your own web application
    by visiting the <a href="https://www.pythonanywhere.com/web_app_setup/">web app setup</a> page
</p>
</body>
</html>"""


def application(environ, start_response):
    if environ.get('PATH_INFO') == '/':
        status = '200 OK'
        #content = HELLO_WORLD
        content = open("index.html").read()
    else:
        status = '404 NOT FOUND'
        content = 'Page not found.'
    response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))]
    start_response(status, response_headers)
    yield content.encode('utf8')

Hi there -- I take it the files that you got from the template provider are all just static HTML/CSS/JavaScript, right?

If so, what you should do is move them all to a place in your home directory (say, /home/ismaelvc1337/static), leaving only the ismaelvc1337_pythonanywhere_com_wsgi.py file and its backups in /var/www, then set up an entry in the static files table for your web app (about halfway down the page) with the URL field empty, and the directory field set to the place where you put the files. That should get you up and running for now.

Thank you very much @Giles! I did exactly as you told me and it's working now. :D I'm very impressed by PythonAnywhere, keep up the good work!

Excellent, glad it's working now :-) And thanks!