Jelajahi Sumber

Installation steps improved

root 6 tahun lalu
induk
melakukan
2cd75ceea1
3 mengubah file dengan 51 tambahan dan 7 penghapusan
  1. 47 3
      README.md
  2. 3 1
      rotbot/bot.py
  3. 1 3
      website/website/settings.py

+ 47 - 3
README.md

@@ -5,6 +5,9 @@ Django project, without virtual environment.
 Hint, to create a virtualenv in the current dir: `virtualenv --python=python3.7 .`
 This probably requires you to have built python3.7 manually and have debian packages installed: `python3-virtualenv python-virtualenv`
 
+Then activate the virtenv: `source bin/activate`
+To later deactive: `deactivate`
+
 
 # Prerequisites
 
@@ -15,17 +18,58 @@ Currently newer then in the repo's, if that's still the case, you might have to
 
 If you notice you can' t use ssl when using pip, you should have installed `libssl-dev` before building python, or any of the following packages: `libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev`
 
+## System packages needed for psycopg2
+Install either postgresql-server-dev-X.Y or libpq-dev: `sudo apt install`...
 
 ## Python packages
 
 Install required pyton packages: `pip3 install -r requirements.txt`
 
+## Postgres database with user.
+
+Fill in the passwords, don't change the database name, it's hardcoded in pyRot, for now.
+1. `sudo apt install postrgresql`
+1. `sudo su - postgresql`
+1. `psql`
+1. `CREATE ROLE website WITH LOGIN PASSWORD '';
+1. `CREATE DATABASE website WITH OWNER = website;`
+1. `CREATE ROLE pyrot WITH LOGIN PASSWORD '';`
+1. `GRANT ALL ON DATABASE website TO pyrot;`
+
+## Settings file.
+
+For now, set the database authentication details in the following files:
+1. website/website/settings.py
+1. rotbot/bot.py
+
+## Create the database tables.
+
+1. `cd website`
+1. `python manage.py makemigrations`
+1. `python manage.py migrate`
+
+
+# Testing the project.
 
-# Fomatic-ui 2.7.8
+## webgui
 
-## Requirements: NodeJS 10.15.3 & NPM 6.4.1
+1. `cd website`
+1. `python manage.py runserver`
+
+## pyRot
+The pythonic version of RotBot, there have been 5 earlier versions including winRot and javaRot.
+
+1. `cd rotbot`
+1. `python bot.py 1` Where `1` is the ID of the server database record.
+
+
+# Edeting the look of the webgui
+
+## Build Fomatic-ui 2.7.8 
+
+### Requirements: NodeJS 10.15.3 & NPM 6.4.1
 
 On debian: `sudo apt install npm`
 
 
-## Init
+

+ 3 - 1
rotbot/bot.py

@@ -221,7 +221,9 @@ def main():
         sys.exit('To run type "python bot.py database_network_id", not: %s. Terminating program.' % (sys.argv)) # Terminate program.
     instance = sys.argv[1]  # Instance is the database network id.
 
-    db_connect_string='postgres://pyrot:oGPnbiqh55QKLhmnKQgS92h74j0e9d6LE58cSsD1@localhost/website'
+    username = 'pyrot'
+    password = 'oGPnbiqh55QKLhmnKQgS92h74j0e9d6LE58cSsD1'
+    db_connect_string='postgres://%s:%s@localhost/website' % username, password
     try:
         db = Postgres(db_connect_string)    # Connect to database.
     except:

+ 1 - 3
website/website/settings.py

@@ -12,11 +12,9 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
 
 import os
 
-
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
-
 # Quick-start development settings - unsuitable for production
 # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
 
@@ -24,7 +22,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 SECRET_KEY = 'f_nxx)y&fw6*u#dd_du6y9&)1$q+a0!y38+6sk151+6)@1kxge'
 
 # SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True
+DEBUG = False
 
 ALLOWED_HOSTS = []