Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


How to deploy the learning site app on a local server?

I want to run this app on a local server and in the end on AWS. Can someone guide me on the steps I can take?

4 Answers

Keith Whatling
Keith Whatling
17,696 Points

Ah the big step.

Look at could 9 then pythonanywhere, pythonanywhere runs on AWS but does all the IT techy stuff for you. I really struggle with gunicorn and all that wsgi nigx what ever its called.

Cloud 9 is just like using workspaces but with more grunt, and a great IDE plus its free!

for your local machine,

python manage.py runserver

Thanks Keith! But I am getting an error when moving forward

Thanks Kara .. But when i am running the local server it gives me the error as follows.I am not sure what is going on:

NoReverseMatch at / Reverse for 'views.hello_world' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] Request Method: GET Request URL: Django Version: 1.10.dev20151122193214 Exception Type: NoReverseMatch Exception Value:
Reverse for 'views.hello_world' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] Exception Location: /Users/prasanna/Downloads/django/django/core/urlresolvers.py in _reverse_with_prefix, line 454 Python Executable: /usr/bin/python Python Version: 2.7.10 Python Path:
['/Users/prasanna/Desktop/learningsite', '/Users/prasanna/Downloads/django', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages'] Server time: Mon, 23 Nov 2015 11:19:41 -0800

Kenneth Love Help please!

Keith Whatling
Keith Whatling
17,696 Points

Post your code, it looks like there is an error in veiws.hello_world.

My url file is as follows:

from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from . import views

urlpatterns = [
    url(r'^courses/', include('courses.urls', namespace='courses')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', views.hello_world),

urlpatterns += staticfiles_urlpatterns()

And this is the views file

from django.shortcuts import render

def hello_world(request):
    return render(request, 'home.html')

This is the setting file

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '&s5%_8r2y$9%pbnph*xy*%v^a_!vc0bmbqz%(+l#pc@k7n2r)+'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True




ROOT_URLCONF = 'learning_site.urls'

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates',],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

WSGI_APPLICATION = 'learning_site.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),

# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/


TIME_ZONE = 'America/Los_Angeles'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'
    os.path.join(BASE_DIR, 'assets'),

And this is the home.html file

{% extends "layout.html" %}

{% block title %}Well hello there!{% endblock %}

{% block content %}
{% endblock %}

And finally this is the template file:

{% load static from staticfiles %}

<!doctype html>
        <title>{% block title %}{% endblock %}</title>
        <link rel="stylesheet" href="{% static 'css/layout.css' %}">
        <div class="site-container">
                <a href="{% url 'views.hello_world' %}">Home</a>
                <a href="{% url 'courses:list' %}">Courses</a>
            {% block content %}{% endblock %}


Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Weird, I don't see anything obviously wrong.

Is that the only error message you get? What if you try to go to one of the courses/ URLs?