#!/usr/local/bin/python3 import cgi print("Content-type: text/html") from lib import helpers print(helpers.render('header', {'title': "MVC"})) print(''' <p>MVC</p> <p>This is the article for MVC</p> ''') print(helpers.render('footer'))
#!/usr/local/bin/python3 import cgi print("Content-type: text/html") ## This block of code just sets the dir path ## one level up (so we can access lib and templates # set package to .. import sys import os PACKAGE_PARENT = '..' SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__)))) sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT))) # set package to .. end from lib import helpers print(helpers.render('header', {'title': "UP DevCamp"})) print(''' <ul><a href="tracks.py">Tracks</ul> <ul><a href="resources.py">Resources</ul> ''') print(helpers.render('footer'))
#!/usr/local/bin/python3 import cgi print("Content-type: text/html") import sys import os PACKAGE_PARENT = '..' SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__)))) sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT))) from lib import helpers print(helpers.render('header', {'title': "Web Setup"})) print(''' <p>Web Setup</p> <p>This is the article for Web Setup</p> ''') print(helpers.render('footer'))
#!/usr/local/bin/python3 import cgi print("Content-type: text/html") from lib import helpers print(helpers.render('header', {'title': "Tracks"})) print(''' <ul><a href="web.py">Web</ul> ''') print(helpers.render('footer'))
#!/usr/local/bin/python3 import cgi print("Content-type: text/html") import sys import os PACKAGE_PARENT = '..' SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__)))) sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT))) from lib import helpers print(helpers.render('header', {'title': "Resources"})) print(''' <ul><a href="python.py">Python</ul> <ul><a href="linux.py">Linux</ul> ''') print(helpers.render('footer'))
#!/usr/local/bin/python3 import cgi print("Content-type: text/html") from lib import helpers print(helpers.render('header', {'title': "Python"})) print(''' <p>Python</p> <p>This is the article for Python</p> ''') print(helpers.render('footer'))