Skip to content

Commit

Permalink
moved the modules into package
Browse files Browse the repository at this point in the history
  • Loading branch information
tecoholic committed May 10, 2015
1 parent a5a212b commit 4ba51a1
Show file tree
Hide file tree
Showing 25 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ docs/_build/
# PyBuilder
target/

static/zim/*.zim
zimbalaka/static/zim/*.zim
3 changes: 3 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from zimbalaka import app

app.run( debug=True )
8 changes: 2 additions & 6 deletions zimbalaka.py → zimbalaka/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import os

app = Flask(__name__)
app.config['CELERY_BROKER_URL'] = 'redis://localhost:6379/0'
app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost:6379/0'
app.config.from_object('zimbalaka.default_settings')
# app.config.from_envvar('ZIMBALAKA_SETTINGS') # used for loading production config

celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
Expand Down Expand Up @@ -52,7 +52,3 @@ def download(task_id,filename):
except IOError:
return 'The file you have requested has been deleted from the server. Zim files are stored only for 59 minutes.'


if __name__ == "__main__":
app.debug = True
app.run()
File renamed without changes.
File renamed without changes.
File renamed without changes
10 changes: 10 additions & 0 deletions zimbalaka/default_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The default settings is for the **development**
# NOTE You **MUST** change this before running production

DEBUG = True
SECRET_KEY = 'development key'

# Celery conf when using REDIS as broker
# NOTE Change this if you want to use a different broker
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions utils.py → zimbalaka/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def clean_page(html):
doc.remove(sec.strip())
# add the styles
if not os.path.isfile(os.path.join(dloc,"assets","style1.css")):
shutil.copytree("assets", dloc+'/assets') # copt the stylesheets to the tmp folder
shutil.copytree(os.path.join( os.path.dirname(__file__), 'assets'),
os.path.join( dloc,'assets') ) # copt the stylesheets to the tmp folder
doc('head').append('<link rel="stylesheet" href="assets/style1.css" type="text/css">')
doc('head').append('<link rel="stylesheet" href="assets/style2.css" type="text/css">')
# place the images
Expand Down Expand Up @@ -126,7 +127,7 @@ def zimit(title, articles):
command = "/usr/local/bin/zimwriterfs -w "+w+" -f "+f+" -l "+l+" -t "+t+" -d "+d+" -c "+c+" -p "+p+" "+directory+" "+zimfile
call(command, shell=True)
tmpdir, zim = os.path.split(zimfile)
newzim = "static/zim/"+zim
newzim = os.path.join( os.path.dirname( __file__ ), 'static', 'zim', zim)
shutil.copy(zimfile, newzim)
shutil.rmtree(tmpdir)
print newzim #TODO Fix the following
Expand All @@ -137,4 +138,4 @@ def zimit(title, articles):
if len(sys.argv) < 2:
print "insufficient params"
else:
zimit(sys.argv[1])
zimit(sys.argv[1], sys.argv[2])

0 comments on commit 4ba51a1

Please sign in to comment.