Skip to content

Commit

Permalink
Got dotcloud integration working
Browse files Browse the repository at this point in the history
  • Loading branch information
thenoviceoof committed Sep 5, 2011
1 parent 129e877 commit 0eca156
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,5 +4,6 @@
*tmp/html/*.html
*tmp/pdf/*.pdf
*.swp
*.so.*
wkhtmltopdf
site.conf
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -44,6 +44,21 @@ And you also need in the top level of the git repo (next to flyer.py):
* A tmp directory (run `mkdir tmp`)


DOTCLOUD INSTALL
================================================================================

So you want to upload this to dotcloud?

* Sign up for a dotcloud account
* Install the dotcloud client side CLI
* Register your API key with your client
* Then, do this:

dotcloud push --all flyergen .

* The --all option pushes your wkhtmltopdf along with everything else


USAGE
================================================================================

Expand Down
16 changes: 14 additions & 2 deletions flyer.py
Expand Up @@ -126,9 +126,21 @@ def flyer(self, tagline="", description="", date="", time="",
location=location)
# now, convert it
### need to do error handling
proc = subprocess.Popen([cwd+"/wkhtmltopdf","-","-"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
proc = subprocess.Popen([cwd+"/wkhtmltopdf",
"--page-size","Letter",
"-","-"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# to get wkhtmltopdf to stop complaining
# about a missing libXrender.so.1
env={"LD_LIBRARY_PATH":
"%s" % cwd},
shell=False)
outdata, errdata = proc.communicate(input=html)
cherrypy.log("Outdata: "+str(len(str(outdata))))
cherrypy.log("Errdata: "+str(errdata))
if not(errdata is None):
cherrypy.log("Error: "+errdata)
return "Error: "+errdata
cherrypy.response.headers['Content-Type'] = 'application/pdf'
### maybe save pdf, also
return outdata
Expand Down
8 changes: 6 additions & 2 deletions static/css/lolhawk.css
@@ -1,7 +1,11 @@
body {
body {
position:absolute;
left:0;
top:0;
width:7.5in;
height:10in;
height:9.9in;
margin:0;
padding:0;
font-size:12px;
}

Expand Down
4 changes: 2 additions & 2 deletions templates/lolhawk.html
Expand Up @@ -35,7 +35,7 @@ <h2>
<h2 id="location_body">{{ location }}</h2>

<!--Fix this: need a good way to hot-swap footer/other branding-specific layout styles-->
<div style="display:block;position:absolute;top:6.4in;width:7.5in;">
<div style="display:block;position:absolute;top:6.3in;width:7.5in;">
<h4>Brought to you by the<br/>Application Development Initiative</h4>
<img src="{{ static_path }}/img/qrcode.png" style="height:6cm;float:left;" />
<img src="{{ static_path }}/img/adi_logo.png" style="height:4cm;float:right;margin-top:1cm;" />
Expand All @@ -46,7 +46,7 @@ <h4>Brought to you by the<br/>Application Development Initiative</h4>

<!-- Editor code -->
<div id="editor">
<form action="flyer">
<form action="flyer" method="POST">
<input type="submit" value="Render" />
<button id="more-options">More Options</button>
<ul id="editor-options">
Expand Down

0 comments on commit 0eca156

Please sign in to comment.