erpnext installer

This commit is contained in:
Anand Doshi 2012-05-10 12:39:25 +05:30
parent df8b4ab9b1
commit 17fb35fa4a
3 changed files with 210 additions and 62 deletions

117
install_erpnext.py Normal file
View File

@ -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

View File

@ -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;

View File

@ -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('<div class="page-footer">\
<h2 style="padding: 0px">Try before you buy. \
Request a 30-day Free Trial.</h2><br>\
\
<input name="company_name" type="text" placeholder="Company Name"> \
<input name="sender_name" type="text" placeholder="Your Name"> \
<input name="email" type="text" placeholder="Email"> \
<input name="password" type="password" placeholder="Password"> \
<button class="btn btn-success btn-small btn-request">Request</button>\
\
<p>Note: Free trials usually take one business day to setup. \
Please fill out your genuine information because we verify \
your name and company before setting up a demo to \
ensure that spammers don\'t crash our servers. \
If you would like to see something right now, \
<a href="#!demo">jump to the demo.</a></p>\
\
<p style="font-size: 90%; margin-top: 10px;">\
Request a 30-day Free Trial.</h2>\
<ul>\
<li><a href="erpnext-pricing.html">Starts at an un-believable $299 per year.</a>\
<li><a href="http://demo.erpnext.com" target="_blank">\
Show me a full demo (new page).</a>\
<li><a href="sign-up.html">Take me to the sign-up page.</a>\
</ul>\
<p>\
<i class="icon-hand-right"></i> <b>ERPNext Goodies:</b> <span class="goodie">'
+ goodies[parseInt(Math.random() * goodies.length)]+
'</goodie></p>\
</span>');
<p>ERPNext is <a href="open-source.html">Open Source</a> under the GNU/General Public License.</p>\
<p><g:plusone size="medium" annotation="inline"></g:plusone></p>\
\
<table><tr><td style="width: 115px">\
<a href="https://twitter.com/erpnext" class="twitter-follow-button" \
data-show-count="false">Follow @erpnext</a></td>\
<td style="width: 150px; font-size: 80%; vertical-align: middle;">\
Get status updates on Twitter.</td></tr>\
</table>');
// bind the events
// render plusone
window.gapi && window.gapi.plusone.go();
$('#page-'+page_name+' .btn-request').click(function() {
var page = $('#page-' + wn.container.page.page_name);
var args = {
sender_name: page.find('[name="sender_name"]').val(),
company_name: page.find('[name="company_name"]').val(),
email: page.find('[name="email"]').val(),
password: page.find('[name="password"]').val()
}
if(!(args.sender_name && args.company_name && args.email && args.password)) {
msgprint("All fields are necessary. Please try again.");
return;
}
erpnext.send_message({
subject:'New Trial Request',
sender: page.find('[name="sender_name"]').val(),
message: args,
callback: function() {
page.find(':input').val('');
}
});
});
// render twitter button
twttr.widgets.load();
}
//////////////// Hide Login for frappe!
$(document).ready(function() {
setTimeout("$('#login-topbar-item').toggle(false);", 1000);
});
//////////////// Analytics
window._gaq = window._gaq || [];
window._gaq.push(['_setAccount', 'UA-8911157-1']);
window._gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
/////////////// Page view
$(window).bind('hashchange', function() {
window._gaq.push(['_trackPageview', wn.get_route_str()]);
});
/////////////// Update conversion
erpnext.update_conversion = function() {
$('body').append('<div style="display:inline;">\
<img height="1" width="1" style="border-style:none;" alt="" \
src="http://www.googleadservices.com/pagead/conversion/1032834481/?label=JvAUCLX41gEQsZu_7AM&amp;guid=ON&amp;script=0"/>\
</div>')
};
////////////// Plus One
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
////////////// Twitter
(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);}})(document,"script","twitter-wjs");