Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-python
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-python
Commits
5aa4e7c9
Commit
5aa4e7c9
authored
Sep 07, 2011
by
Craig Kerstiens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaking settings to be safer, and removing requirement of psycopg2 for django
parent
e7495df1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
compile
bin/compile
+22
-17
No files found.
bin/compile
View file @
5aa4e7c9
...
@@ -45,19 +45,28 @@ if [ "$NAME" = "Python/Django" ]; then
...
@@ -45,19 +45,28 @@ if [ "$NAME" = "Python/Django" ]; then
echo
" Injecting code into
$SETTINGS_FILE
to read from DATABASE_URL"
echo
" Injecting code into
$SETTINGS_FILE
to read from DATABASE_URL"
cat
>>
$SETTINGS_FILE
<<
EOF
cat
>>
$SETTINGS_FILE
<<
EOF
import os, urlparse
import os, urlparse
if os.environ.has_key('DATABASE_URL'):
try:
urlparse.uses_netloc.append('postgres')
if os.environ.has_key('DATABASE_URL'):
url = urlparse.urlparse(os.environ['DATABASE_URL'])
urlparse.uses_netloc.append('postgres')
DATABASES['default'] = {
urlparse.uses_netloc.append('mysql')
'ENGINE': 'django.db.backends.postgresql_psycopg2',
url = urlparse.urlparse(os.environ['DATABASE_URL'])
'NAME': url.path[1:],
DATABASES['default'] = {
'USER': url.username,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'PASSWORD': url.password,
'NAME': url.path[1:],
'HOST': url.hostname,
'USER': url.username,
'PORT': url.port,
'PASSWORD': url.password,
}
'HOST': url.hostname,
'PORT': url.port,
}
if 'postgres' in os.environ['DATABASE_URL']:
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2',
if 'mysql' in os.environ['DATABASE_URL']:
DATABASES['default']['ENGINE'] = 'django.db.backends.mysql',
except:
print "Unexpected error:", sys.exc_info()
raise
EOF
EOF
echo
"-----> Django script installation"
echo
"-----> Django script installation"
...
@@ -75,12 +84,8 @@ PIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE bin/pip install -r requirements.txt | sed
...
@@ -75,12 +84,8 @@ PIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE bin/pip install -r requirements.txt | sed
echo
"-----> Making virtualenv relocatable"
echo
"-----> Making virtualenv relocatable"
virtualenv
--relocatable
.
|
sed
-u
's/^/ /'
virtualenv
--relocatable
.
|
sed
-u
's/^/ /'
if
[
"
$NAME
"
=
"Python/Django"
]
;
then
bin/pip freeze |
grep
psycopg2
>
/dev/null
||
{
echo
" ! Missing psycopg2 dependency in requirements.txt"
;
exit
1
;
}
fi
# store new artifacts in cache
# store new artifacts in cache
for
dir
in
$VIRTUALENV_DIRS
;
do
for
dir
in
$VIRTUALENV_DIRS
;
do
rm
-rf
$CACHE_DIR
/
$dir
rm
-rf
$CACHE_DIR
/
$dir
cp
-R
$dir
$CACHE_DIR
/
cp
-R
$dir
$CACHE_DIR
/
done
done
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment