1 # -*- coding: utf-8 -*-
2 """Setup the floof application"""
5 from floof
.config
.environment
import load_environment
7 log
= logging
.getLogger(__name__
)
9 from pylons
import config
11 from floof
import model
as model
15 def setup_app(command
, conf
, vars):
16 """Place any commands to setup floof here"""
17 load_environment(conf
.global_conf
, conf
.local_conf
)
20 model
.metadata
.create_all()
24 from floof
.model
.users
import IdentityURL
, User
25 identity_url
= IdentityURL(url
=u
'http://eevee.livejournal.com/')
26 user
= User(name
=u
'eevee')
27 user
.identity_urls
.append(identity_url
)
29 model
.Session
.commit()
33 # Only necessary if we're using the filesystem for storage.
35 art_path
= os
.path
.join(config
['app_conf']['static_root'], 'art')
36 # Test that we can write to the art directory
37 if os
.access(art_path
, os
.W_OK | os
.X_OK
):
38 # Create directories for various image sizes
39 for subdir
in ['original', 'medium', 'thumbnail']:
40 path
= os
.path
.join(art_path
, subdir
)
41 # If it exists, it should be writeable. If not, create it.
42 if os
.path
.exists(path
):
43 if not os
.access(path
, os
.W_OK | os
.X_OK
):
44 print "*** WARNING: Can't write to the art/{0} " \
45 "directory!".format(subdir
)
49 print "*** WARNING: Can't write to the art directory!"