Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 57c6caf

Browse files
author
Stephen Hoogendijk
committedSep 29, 2013
Added relational path issue fix
1 parent 1a55678 commit 57c6caf

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed
 

‎create-vhost.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
do_git_checkout = False
1111
assume_yes = False
1212

13+
cwd = os.path.dirname(os.path.realpath(__file__))
14+
vhost_tpl_path = cwd+'/vhost.tpl'
15+
1316
if not os.access('/etc/hosts', os.W_OK):
1417
exit('Cannot write to /etc/hosts, please run this script as root or with sudo')
1518

16-
if not os.access('vhost.tpl', os.W_OK):
19+
if not os.access(vhost_tpl_path, os.W_OK):
20+
print vhost_tpl_path
1721
exit('Cannot read vhost template file!')
1822

1923
cfg = ConfigParser.ConfigParser()
20-
configfile = 'create-vhost.ini'
24+
configfile = cwd+'/create-vhost.ini'
2125

2226
print '--- Create vhost script for Apache2 ---'
2327
print '--- Copyright Stephen Hoogendijk 2013, Licensed under the GPL V2 License ---'
@@ -97,7 +101,7 @@ def create_vhost():
97101

98102

99103
# read the template and replace the variables
100-
vhost_tpl = open('vhost.tpl', 'r').read()
104+
vhost_tpl = open(vhost_tpl_path, 'r').read()
101105

102106

103107
vhost_tpl = vhost_tpl.replace('{APACHE_PORT}', str(apache_port))

‎vhost_test.dev.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<VirtualHost *:80>
2+
ServerName test.dev
3+
ServerAlias www.test.dev
4+
DocumentRoot "/var/www/test"
5+
<Directory "/var/www/test">
6+
AllowOverride All
7+
Order allow,deny
8+
Allow from all
9+
</Directory>
10+
</VirtualHost

0 commit comments

Comments
 (0)
Please sign in to comment.