官术网_书友最值得收藏!

Initializing a new Odoo database

To create and initialize an Odoo database with the Odoo data schema, we should run the Odoo server using the -d option:

$ ~/odoo-dev/odoo/odoo-bin -d testdb

This will take a couple of minutes to initialize the testdb database, and it will end with an INFO log message, Modules loaded. Note that it might not be the last log message, and it can be in the last three or four lines. With this, the server will be ready to listen to client requests.

Since Odoo 9.0, the database is automatically created if it doesn't exist yet. In version 8.0, this was not so, and you needed to create the database manually, using the createdb command.

By default, this will initialize the database with demonstration data, which is often useful for development databases. This is the equivalent to having the Load demonstration data checkbox ticked when creating a new database from the user interface.

To initialize a database without demonstration data, add the --without-demo=all option to the command.

To be able to create a new database, your user must be a PostgreSQL superuser. The PostgreSQL setup script used in the previous section takes care of that. Just in case you also need it for some other user, this is the command to make the current Unix user a PostgreSQL superuser:

$ sudo createuser --superuser $(whoami)
For a development environment, it is fine for the user running the Odoo instance to be a database superuser. However, for a production environment, Odoo security best practices recommend to never run a production instance with a database user that is a superuser.

Now that we have a running Odoo instance, we can access it by opening the http://<server-name>:8069 URL with a web browser. This should present us with the Odoo login screen. If you don't know your server name, type the hostname command in the terminal in order to find it or the ifconfig command to find the IP address.

The default administrator account is admin, with its password admin. Upon login, you are presented with the Apps menu, displaying the available applications.

To stop the Odoo server instance and return to the command line, press Ctrl + C at the terminal window running the server. Pressing the up arrow key will bring us the previous shell command, so it's a quick way to start Odoo again with the same options. The Ctrl + C keys followed by the up arrow key and Enter is a frequently used combination to restart the Odoo server during development.

主站蜘蛛池模板: 黄陵县| 景洪市| 高雄县| 屏东市| 北流市| 普宁市| 肥乡县| 清镇市| 墨脱县| 司法| 肇东市| 乐亭县| 商丘市| 崇州市| 沁水县| 麻阳| 谢通门县| 铜山县| 星子县| 赫章县| 彭阳县| 岑巩县| 宜川县| 内黄县| 崇文区| 监利县| 珠海市| 襄城县| 繁峙县| 扎赉特旗| 大港区| 中方县| 上杭县| 镇原县| 桐乡市| 逊克县| 涟源市| 呼玛县| 沙坪坝区| 龙口市| 五常市|