Selaa lähdekoodia

[minors] Added helpers for install, fixing README.md

version-14
Rushabh Mehta 11 vuotta sitten
vanhempi
commit
4113694d73
3 muutettua tiedostoa jossa 50 lisäystä ja 15 poistoa
  1. +12
    -10
      README.md
  2. +4
    -4
      conf/conf.py
  3. +34
    -1
      wnf.py

+ 12
- 10
README.md Näytä tiedosto

@@ -1,6 +1,6 @@
## wnframework

Full-stack web application framework that uses python/mysql on the server side and a tightly integrated client side library. Primarily built for erpnext.
Full-stack web application framework that uses Python/MySql on the server side and a tightly integrated client side library. Primarily built for erpnext.

Projects: [erpnext](http://erpnext.org) | [webnotes/erpnext](https://github.com/webnotes/erpnext)

@@ -8,15 +8,17 @@ Projects: [erpnext](http://erpnext.org) | [webnotes/erpnext](https://github.com/

To start a new project, in the application root:

1. Set wnframework folder as the `lib` folder.
1. Copy the following files from lib/conf: `index.cgi`, `build.json`, `conf.py`.
1. Create folders `js`, `css`, `modules`, `modules/startup`. These folders contain the js, css assets and modules folder is where all the new application modules will be created.
1. Update database name/password in conf.py and set modules folder to "modules".
1. Run `$ lib/wnf.py --install dbrootpassword newdbname lib/conf/Framework.sql` to install a fresh database.
1. Create `app.js` containing basic application info (see `lib/conf`)
1. Create empty files `__init__.py` and `event_handlers.py` in `modules/startup`. This is where you write all events (like, onlogin, onlogout etc)
1. Run `$ lib/wnf.py -b` to build js and css assets from `build.json`.
1. Go to the browser and go to your application folder. The admin username is "Administrator" and password is "admin"
Note:

1. wnframework must be called as `lib`
1. your application must be called as `app`

Finally:

$ git clone git@github.com:webnotes/wnframework lib
$ git clone git@github.com:webnotes/[your app] app
$ lib/wnf.py --make_conf
$ lib/wnf.py --reinstall

enjoy!



+ 4
- 4
conf/conf.py Näytä tiedosto

@@ -5,8 +5,8 @@ from __future__ import unicode_literals
# app configuration

# database config
db_name = 'yourdbname'
db_password = 'yourdbpassword'
db_name = '%(db_name)s'
db_password = '%(db_password)s'

# user attachments stored in
files_path = 'public/files'
@@ -15,10 +15,10 @@ files_path = 'public/files'
max_file_size = 1000000

# generate schema (.txt files)
developer_mode = 0
developer_mode = 1

# clear cache on refresh
auto_cache_clear = 0
auto_cache_clear = 1

# email logs to admin (beta)
admin_email_notification = 0


+ 34
- 1
wnf.py Näytä tiedosto

@@ -139,6 +139,9 @@ def setup_options():
parser.add_option('--install_fresh', nargs=1, metavar = "NEW_DB_NAME",
help="install fresh db")

parser.add_option('--reinstall', default=False, action="store_true",
help="install fresh db in db_name specified in conf.py")

parser.add_option('--make_demo', default=False, action="store_true",
help="install in database 'demo'")

@@ -276,6 +279,9 @@ def setup_options():
parser.add_option("--reset_perms", default=False, action="store_true",
help="Reset permissions for all doctypes.")

parser.add_option("--make_conf", default=False, action="store_true",
help="Create new conf.py file")

return parser.parse_args()
def run():
@@ -333,7 +339,7 @@ def run():
webnotes.connect(options.db_name, options.password)
else:
webnotes.connect(options.db_name)
elif not any([options.install, options.pull, options.install_fresh]):
elif not any([options.install, options.pull, options.install_fresh, options.reinstall, options.make_conf]):
webnotes.connect(conf.db_name)

if options.pull:
@@ -397,6 +403,12 @@ def run():
inst = Installer('root')
inst.import_from_db(options.install_fresh, verbose = 1)

elif options.reinstall:
from webnotes.install_lib.install import Installer
inst = Installer('root')
import conf
inst.import_from_db(conf.db_name, verbose = 1)

elif options.make_demo:
import utilities.demo.make_demo
utilities.demo.make_demo.make()
@@ -507,6 +519,27 @@ def run():
webnotes.reset_perms(d)
except:
pass
elif options.make_conf:
if os.path.exists("conf.py"):
os.system("mv conf.py conf.py.bak")
with open("lib/conf/conf.py", "r") as confsrc:
confstr = confsrc.read()
db_name = raw_input("Database Name: ")
if not db_name:
print "Database Name Required"
return
db_password = raw_input("Database Password: ")
if not db_password:
print "Database Name Required"
return
with open("conf.py", "w") as conftar:
conftar.write(confstr % {"db_name": db_name, "db_password": db_password })

if __name__=='__main__':


Ladataan…
Peruuta
Tallenna