mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
erpnext installer
This commit is contained in:
117
install_erpnext.py
Normal file
117
install_erpnext.py
Normal 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
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#body_div {
|
#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;
|
font-size: 14px !important;
|
||||||
@@ -17,10 +17,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5 {
|
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;
|
clear: both;
|
||||||
margin: -50px;
|
margin: -50px;
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
background-color: #DEE1D0; //#E7DFCA;
|
background-color: #FFFAED;
|
||||||
padding: 50px;
|
padding: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,19 +117,12 @@ h2 {
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
|
||||||
height: 75px;
|
|
||||||
width: 75px;
|
|
||||||
border-radius: 100px 100px 100px 100px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.link-big {
|
.link-big {
|
||||||
font-size: 140%;
|
font-size: 140%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sticky {
|
.sticky {
|
||||||
background-color: #FFFBC4;
|
background-color: #F0EDDD;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
window.home_page = "index";
|
window.home_page = "home";
|
||||||
// footer signup widget
|
// footer signup widget
|
||||||
// automatically adds it to the .layout-main div of the page
|
// automatically adds it to the .layout-main div of the page
|
||||||
// adds events and also random goodies.
|
// adds events and also random goodies.
|
||||||
@@ -8,18 +8,30 @@ erpnext.set_request_signup = function(page_name) {
|
|||||||
// goodies
|
// goodies
|
||||||
var goodies = [
|
var goodies = [
|
||||||
"ERPNext also contains a module to build your website. \
|
"ERPNext also contains a module to build your website. \
|
||||||
The way it works is, when you log out, the app becomes your website. \
|
The way it works is, when you log out, the app becomes your website. \
|
||||||
This website is generated from ERPNext.",
|
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">\
|
$('#page-' + page_name + ' .layout-main').append('<div class="page-footer">\
|
||||||
<h2 style="padding: 0px">Try before you buy. \
|
<h2 style="padding: 0px">Try before you buy. \
|
||||||
Request a 30-day Free Trial.</h2><br>\
|
Request a 30-day Free Trial.</h2>\
|
||||||
\
|
<ul>\
|
||||||
<input name="company_name" type="text" placeholder="Company Name"> \
|
<li><a href="erpnext-pricing.html">Starts at an un-believable $299 per year.</a>\
|
||||||
<input name="sender_name" type="text" placeholder="Your Name"> \
|
<li><a href="http://demo.erpnext.com" target="_blank">\
|
||||||
<input name="email" type="text" placeholder="Email"> \
|
Show me a full demo (new page).</a>\
|
||||||
<input name="password" type="password" placeholder="Password"> \
|
<li><a href="sign-up.html">Take me to the sign-up page.</a>\
|
||||||
<button class="btn btn-success btn-small btn-request">Request</button>\
|
</ul>\
|
||||||
\
|
<p>\
|
||||||
<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;">\
|
|
||||||
<i class="icon-hand-right"></i> <b>ERPNext Goodies:</b> <span class="goodie">'
|
<i class="icon-hand-right"></i> <b>ERPNext Goodies:</b> <span class="goodie">'
|
||||||
|
|
||||||
+ goodies[parseInt(Math.random() * goodies.length)]+
|
+ goodies[parseInt(Math.random() * goodies.length)]+
|
||||||
|
|
||||||
'</goodie></p>\
|
'</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();
|
||||||
|
|
||||||
|
// render twitter button
|
||||||
|
twttr.widgets.load();
|
||||||
|
}
|
||||||
|
|
||||||
$('#page-'+page_name+' .btn-request').click(function() {
|
//////////////// Hide Login for frappe!
|
||||||
|
|
||||||
var page = $('#page-' + wn.container.page.page_name);
|
$(document).ready(function() {
|
||||||
var args = {
|
setTimeout("$('#login-topbar-item').toggle(false);", 1000);
|
||||||
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)) {
|
//////////////// Analytics
|
||||||
msgprint("All fields are necessary. Please try again.");
|
|
||||||
return;
|
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);
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
erpnext.send_message({
|
/////////////// Page view
|
||||||
subject:'New Trial Request',
|
|
||||||
sender: page.find('[name="sender_name"]').val(),
|
$(window).bind('hashchange', function() {
|
||||||
message: args,
|
window._gaq.push(['_trackPageview', wn.get_route_str()]);
|
||||||
callback: function() {
|
});
|
||||||
page.find(':input').val('');
|
|
||||||
}
|
/////////////// 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&guid=ON&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");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user