From 17fb35fa4a2e9c5d3781ec63763561f169369f73 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 10 May 2012 12:39:25 +0530 Subject: [PATCH] erpnext installer --- install_erpnext.py | 117 ++++++++++++++++++++++++++++++++++++ public/css/wn-web.css | 19 ++---- public/js/wn-web.js | 136 +++++++++++++++++++++++++++--------------- 3 files changed, 210 insertions(+), 62 deletions(-) create mode 100644 install_erpnext.py diff --git a/install_erpnext.py b/install_erpnext.py new file mode 100644 index 0000000000..44485ea18b --- /dev/null +++ b/install_erpnext.py @@ -0,0 +1,117 @@ +#!/usr/bin/python +import os, commands + +# ask for root mysql password +import getpass + +root_pwd = None +while not root_pwd: + root_pwd = getpass.getpass("MySQL Root user's Password: ") + +# test root connection +op = commands.getoutput("mysql -u root -p%s -e 'exit'" % \ + root_pwd.replace('$', '\$').replace(' ', '\ ')) +if "access denied" in op.lower(): + raise Exception("Incorrect MySQL Root user's password") + +# ask for new dbname +new_dbname = None +while not new_dbname: + new_dbname = raw_input("New ERPNext Database Name: ") + +# ask for new dbpassword +new_dbpassword = None +while not new_dbpassword: + new_dbpassword = raw_input("New ERPNext Database's Password: ") + +# get erpnext path +erpnext_path = os.path.dirname(os.path.abspath(__file__)) +os.chdir(erpnext_path) + +# setup backups +if not os.path.exists(os.path.join(erpnext_path, 'backups')): + os.makedirs('backups') + os.symlink(os.path.join(erpnext_path, 'backups'), + os.path.join(erpnext_path, 'public', 'backups')) + +# setup files +if not os.path.exists(os.path.join(erpnext_path, 'files')): + os.makedirs('files') + os.symlink(os.path.join(erpnext_path, 'files'), + os.path.join(erpnext_path, 'public', 'files')) + +# setup logs +if not os.path.exists(os.path.join(erpnext_path, 'logs')): + os.makedirs('logs') + os.system('touch logs/error_log.txt') + +# setup lib -- framework repo with read only access +# change this if you have your own fork +if not os.path.exists(os.path.join(erpnext_path, 'lib')): + os.system('git clone git://github.com/webnotes/wnframework.git') + +# setup symlinks in public +if not os.path.exists(os.path.join(erpnext_path, 'public', 'js', 'lib')): + os.symlink(os.path.join(erpnext_path, 'lib', 'js', 'lib'), + os.path.join(erpnext_path, 'public', 'js', 'lib')) +if not os.path.exists(os.path.join(erpnext_path, 'public', 'images', 'lib')): + os.symlink(os.path.join(eprnext_path, 'lib', 'images'), + os.path.join(erpnext_path, 'public', 'images', 'lib')) + +# extract master +if os.path.exists(os.path.join(erpnext_path, 'data', 'master.sql.gz')): + os.system('gunzip data/master.sql.gz') + +# setup conf +if not os.path.exists(os.path.join(erpnext_path, 'conf.py')): + # read template conf file + with open(os.path.join(erpnext_path, 'lib', 'conf', 'conf.py'), 'r') as template: + content = template.read() + + # manipulate content + import re + + # set new_dbname, new_dbpassword, modules_path, files_path, backup_path, log_file_name + content = re.sub("db_name.*", "db_name = '%s'" % new_dbname, content) + content = re.sub("db_password.*", "db_password = '%s'" % new_dbpassword, content) + content = re.sub("modules_path.*", "modules_path = '%s'" % \ + os.path.join(erpnext_path, 'erpnext'), content) + content = re.sub("files_path.*", "files_path = '%s'" % \ + os.path.join(erpnext_path, 'files'), content) + content = re.sub("backup_path.*", "backup_path = '%s'" % \ + os.path.join(erpnext_path, 'backups'), content) + content = re.sub("log_file_name.*", "log_file_name = '%s'" % \ + os.path.join(erpnext_path, 'logs', 'error_log.txt'), content) + + + # write conf file + with open(os.path.join(erpnext_path, 'conf.py'), 'w') as new_conf: + new_conf.write(content) + +# install db +import sys +sys.path.append(erpnext_path) +sys.path.append(os.path.join(erpnext_path, 'lib')) +import conf +sys.path.append(conf.modules_path) + +from webnotes.install_lib.install import Installer +inst = Installer('root', root_pwd) +inst.import_from_db(new_dbname, source_path=os.path.join(erpnext_path, 'data', 'master.sql'), verbose = 1) + +# apply patches +os.chdir(erpnext_path) +os.system("lib/wnf.py -l") + +# force sync all +os.system("lib/wnf.py --sync_all -f") + +steps_remaining = """ +To Do: + +* Configure apache/http conf file to point to public folder +* chown recursively all files in your folder to apache user +""" + +print steps_remaining + diff --git a/public/css/wn-web.css b/public/css/wn-web.css index 8814437afa..78cb222249 100644 --- a/public/css/wn-web.css +++ b/public/css/wn-web.css @@ -1,9 +1,9 @@ #body_div { - background: url("files/indian-textile-5.gif") repeat; + background: url("../files/indian-textile-5.gif") repeat; - font-family: 'Lato', Verdana, Sans !important; + font-family: 'Arial', Verdana, Sans !important; font-size: 14px !important; @@ -17,10 +17,8 @@ - - h1, h2, h3, h4, h5 { - font-family: 'Lato', Arial, 'Helvetica Neue' !important; + font-family: 'Arial', Arial, 'Helvetica Neue' !important; } @@ -93,7 +91,7 @@ h2 { clear: both; margin: -50px; margin-top: 50px; - background-color: #DEE1D0; //#E7DFCA; + background-color: #FFFAED; padding: 50px; } @@ -119,19 +117,12 @@ h2 { padding: 4px; } -.avatar { - height: 75px; - width: 75px; - border-radius: 100px 100px 100px 100px; - overflow: hidden; -} - .link-big { font-size: 140%; } .sticky { - background-color: #FFFBC4; + background-color: #F0EDDD; padding: 15px; margin-left: 15px; font-size: 12px; diff --git a/public/js/wn-web.js b/public/js/wn-web.js index cd6552ab75..e45acf239c 100644 --- a/public/js/wn-web.js +++ b/public/js/wn-web.js @@ -1,4 +1,4 @@ -window.home_page = "index"; +window.home_page = "home"; // footer signup widget // automatically adds it to the .layout-main div of the page // adds events and also random goodies. @@ -8,18 +8,30 @@ erpnext.set_request_signup = function(page_name) { // goodies var goodies = [ "ERPNext also contains a module to build your website. \ -The way it works is, when you log out, the app becomes your website. \ -This website is generated from ERPNext.", + The way it works is, when you log out, the app becomes your website. \ + This website is generated from ERPNext.", - "You can add custom fields to your transactions in ERPNext to capture specific information about your business.", + "You can add custom fields to your transactions in ERPNext to \ + capture specific information about your business.", - "All forms in ERPNext can be customized, if you feel there are features you do not want to use, you can hide them.", + "All forms in ERPNext can be customized, if you feel there are \ + features you do not want to use, you can hide them.", - "You can email transactions like Quotations and Invoices directly from the system. You can also set this process to become automatic", + "You can email transactions like Quotations and Invoices directly \ + from the system. You can also set this process to become automatic", - "You can create your own Roles and assign user to those roles. You can also set detailed permissions for each role in transactions.", + "You can create your own Roles and assign user to those roles. \ + You can also set detailed permissions for each role in transactions.", - "ERPNext allows you to assign any transaction like an Invoice or Customer Issue to a user. You can also add comments on any transaction." + "ERPNext allows you to assign any transaction like an Invoice \ + or Customer Issue to a user. You can also add comments on any \ + transaction.", + + "Stay on top with a daily, weekly or montly email summarizing all your business\ + activites and accounting data like Income, Receivables, Paybles etc.", + + "Integrate incoming Support queries to your email into ERPNext. \ + Keep track of open tickets and allocate tickets to your users." ]; @@ -28,54 +40,82 @@ This website is generated from ERPNext.", $('#page-' + page_name + ' .layout-main').append('