be104da4b1d563ceb8fdeab81e3bde3f0e94a47c
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 if not User
.query
.filter_by(name
=u
'eevee').count
:
26 identity_url
= IdentityURL(url
=u
'http://eevee.livejournal.com/')
27 user
= User(name
=u
'eevee')
28 user
.identity_urls
.append(identity_url
)
30 ### Make the canonical user-page
31 from floof
.model
import UserPage
32 UserPage
.make_primary_template()
34 model
.Session
.commit()
37 # Only necessary if we're using the filesystem for storage.
39 art_path
= os
.path
.join(config
['app_conf']['static_root'], 'art')
40 # Test that we can write to the art directory
41 if os
.access(art_path
, os
.W_OK | os
.X_OK
):
42 # Create directories for various image sizes
43 for subdir
in ['original', 'medium', 'thumbnail']:
44 path
= os
.path
.join(art_path
, subdir
)
45 # If it exists, it should be writeable. If not, create it.
46 if os
.path
.exists(path
):
47 if not os
.access(path
, os
.W_OK | os
.X_OK
):
48 print "*** WARNING: Can't write to the art/{0} " \
49 "directory!".format(subdir
)
53 print "*** WARNING: Can't write to the art directory!"