Browse Source

Putting up on mule, apache2 mod_wsgi

Tyler Hallada 8 years ago
parent
commit
038843861b
4 changed files with 24 additions and 3 deletions
  1. 0 0
      __init__.py
  2. 8 0
      buzzfeed-haiku-generator.wsgi
  3. 1 1
      generate_poem.py
  4. 15 2
      templates/index.html

+ 0 - 0
__init__.py


+ 8 - 0
buzzfeed-haiku-generator.wsgi

@@ -0,0 +1,8 @@
1
+import os
2
+import sys
3
+sys.path.append('/var/www/buzzfeed-haiku-generator')
4
+
5
+import logging
6
+logging.basicConfig(stream=sys.stderr)
7
+
8
+from app import app as application

+ 1 - 1
generate_poem.py

@@ -32,7 +32,7 @@ class PoemGenerator():
32 32
         self.words = []
33 33
         self.all_words = []
34 34
         self.inflect_engine = inflect.engine()
35
-        with open('buzzfeed_facebook_statuses.csv', newline='') as statuses:
35
+        with open('/var/www/buzzfeed-haiku-generator/buzzfeed_facebook_statuses.csv', newline='', encoding='utf-8') as statuses:
36 36
             reader = csv.reader(statuses, delimiter=',')
37 37
             for row in reader:
38 38
                 if 'via buzzfeed ' not in row[1].lower():  # only English

+ 15 - 2
templates/index.html

@@ -1,10 +1,23 @@
1 1
 <!DOCTYPE html>
2 2
 <html>
3 3
   <head>
4
-    <title>Buzzfeed Haiku Generator</title>
4
+    <title>BuzzFeed Haiku Generator</title>
5
+    <meta name="viewport" content="width=device-width, initial-scale=1">
6
+    <style>
7
+        body {
8
+          text-align: center;
9
+        }
10
+        div.haiku pre {
11
+          font-size: large;
12
+        }
13
+        div.footer {
14
+          font-size: small;
15
+          margin-top: 50px;
16
+        }
17
+    </style>
5 18
   </head>
6 19
   <body>
7
-    <h1>Buzzfeed Haiku Generator</h1>
20
+    <h2>BuzzFeed Haiku Generator</h2>
8 21
     <div class="haiku">
9 22
       <pre>{{haiku}}</pre>
10 23
       <form action="">