diff --git a/README.rst b/README.rst index c66c498..f150f8d 100644 --- a/README.rst +++ b/README.rst @@ -48,6 +48,72 @@ We use submodules to include external libraries in sympy-live:: This is sufficient to clone appropriate repositories in correct versions into sympy-live (see git documentation on submodules for information). +Setting Up for Testing PR 144 +----------------------------- + +You must have python3 installed. You can check your version by:: + + $ python3 -V + +The version must be greater than 3.4. If not present you can install it by:: + + $ sudo apt install python3 + +You need to create the virtual environment and activate it:: + + $ sudo apt-get install python3-venv + $ python3 -m venv env + $ source env/bin/activate + +SymPy Live uses MySQL for database purpose. So you need to setup mysql:: + + $ sudo apt-get install mysql-server + $ sudo apt-get install libmysqlclient-dev + $ sudo apt-get install python3-dev + $ sudo systemctl start mysql + $ sudo mysql + +This will open mysql. You will now have to create a new database with name {database_name}. Create a new user {user_name} and password {user_password}. Grant all previleges to on {database-name}:: + + mysql> CREATE DATABASE {database_name}; + mysql> UPDATE mysql.user SET authentication_string = PASSWORD('{user_password}') WHERE User = '{user_name}'; + mysql> FLUSH PRIVILEGES; + mysql> GRANT ALL PRIVILEGES ON *.* TO '{user_name}'@'localhost' IDENTIFIED BY '{user_password}'; + +To ensure that the database server launches after a reboot, run the following command:: + + $ sudo systemctl enable mysql + +Now in settings.py set up the database for MySQL:: + + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'HOST': '127.0.0.1', # DB's IP address + 'PORT': '3306', + 'NAME': '{database_name}', + 'USER': '{user_name}', + 'PASSWORD': '{user_password}', + } + } + +Install dependencies from requirements.txt:: + + $ pip install -r requirements.txt + +migrate the changes:: + + $ python3 manage.py makemigrations + $ python3 manage.py migrate + $ python3 manage.py createsuperuser # will be used to login into admin panel + +And fianlly:: + + $ python3 manage.py runserver + +This runs the site on localhost. But before using the SymPy Live go to admin panel. There you need to create new user 'anonymous'. You can keep password anythong but name must be exactly same. +Congratulations, now you can test the SymPy Live. + Development server ------------------ diff --git a/shell/views.py b/shell/views.py index 8bd2549..6e7e2c8 100644 --- a/shell/views.py +++ b/shell/views.py @@ -677,6 +677,7 @@ def index(request): context = { # 'server_software': os.environ['SERVER_SOFTWARE'], + 'hosted_on_app_engine': os.getenv('GAE_APPLICATION', None), 'application_version': LIVE_VERSION, 'date_deployed': LIVE_DEPLOYED, 'python_version': sys.version, diff --git a/sympy_live/settings.py b/sympy_live/settings.py index 8d05801..dade02d 100644 --- a/sympy_live/settings.py +++ b/sympy_live/settings.py @@ -105,7 +105,7 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'HOST': '127.0.0.1', # DB's IP address + 'HOST': '127.0.0.1', # DB's IP address 'PORT': '3306', 'NAME': 'sympyDB', 'USER': 'root', diff --git a/templates/base.html b/templates/base.html index 69d94a7..7bcb409 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,6 +5,7 @@ {% block title %}{% endblock %} + {% if hosted_on_app_engine %} @@ -19,6 +20,22 @@ + {% else %} + + + + + + + + + + + + + + + {% endif %}