-
Notifications
You must be signed in to change notification settings - Fork 21
Developing myRobogals on a Mac
Here's how to install a local development copy of myRobogals on Mac OS X.
This guide will be helpful for Linux users too - for the first part, instead install Django using instructions for your specific OS (Google is your friend), then the rest is the same for Linux as for Mac.
We currently use Django 1.7.11 with Python 2.7.13. For maximum compatibility with what's running on the live server, it's recommended that you use these versions too. You will need these items to be installed on your machine in order to run myRobogals
- Python
- Django
- mySQL
- mysql-python
- pytz
- tinymce
- (Optional) Sequel Pro
It is recommended that you install them using Homebrew with the instructions provided below. However, you can install Django, Python and all dependencies however you wish.
Fork the myRobogals repository from Github to create your own copy of it, then check out that copy. The following pages may be helpful:
First off, you will need to have Homebrew installed and updated
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After Homebrew is installed, make sure all the packages are up to date by typing
brew update
myRobogals is using a mySQL database. To be able to view the database in a meaningful way, download Sequel Pro from https://sequelpro.com/ and add it to your applications folder.
Next, you will need to install mySQL through Homebrew and follow the instructions post installation.
brew install mysql
Start the mySQL service after installation
sudo mysql.server start
Secure your MySQL installation. The purpose of doing this is to set up your initial development environment. Follow the prompts to complete installation. If unsure, the suggested responses are yes to all including setting up a password.
mysql_secure_installation
After setting up mySQL, you will need to import a sample database, which can be found in the repo. To import the database, type the following command in terminal. You will be prompted to enter your password.
mysql -u root -p myrobogals < myrobogals.sql
Now go to Sequel Pro and under QUICK CONNECT click SOCKET and type the following:
- Name: localhost
- Username: root
- Password: (what you entered for sql setup)
- Database: myrobogals
Then click connect. After it's connected to the database, go to the top menu and navigate to User Accounts... Down in the bottom right, click the + symbol to create a new account. Make the username myrobogals and password to something. Then click on schema privileges and grant myrobogals user to have access to everything, then click apply. This user will be used by Django to access the myrobogals database.
Install Python 2.7.13 using Homebrew
brew install python
Link python to homebrew. You may have some issues here with linking, if so, try unlinking first then linking.
brew link python
brew unlink python && brew link python
Instead of installing the Django requirements on your computer which may have version and references collisions with what you've previously installed, it is best to use a virtual environment which counteracts this issue. So install virtualenv
pip install pyenv-virtualenv
Create your new virtual environment in any directory you want as long as it's not in the forked myRobogals folders. For now, you can create it in your user home directory
cd
virtualenv venv
Run the virtual environment
. venv/bin/activate
Now go to the cloned myRobogals directory and install the required dependencies listed under requirements.txt
cd (myRobogals folder path)
pip install -r requirements.txt
In the "myrobogals" directory inside the "myrobogals" directory (yes you read that correctly), make a copy of the file "settings.py.sample" and rename it to "settings.py"
Edit the file and fill in the path to your myRobogals directory at the top of the file. This is to ensure that everything gets the proper path references in your project
python manage.py runserver
The development server will now be running on http://127.0.0.1:8000/ - click there and you'll see your very own local copy of myRobogals.
All the sample accounts have the password "test", so you can log in with the username "marita" and password "test" to get started.
Now get coding, and contribute your changes back to us as a "Pull Request" on Github!
We have compiled a list of common problems which you may encounter when setting up the development environment on myRobogals (probably what we've already encountered when setting up), however most of the errors can probably be found through a quick Google search
Sometimes there might be permissions issue with the mySQL database. When trying to start up mySQL for the first time. To check if this is the case, change the directory to where mysql is installed.
cd /usr/local/var/mysql/
Check permissions in that folder.
ls -la
If _mysql doesn't own everything in that folder, use the following commands to change ownership:
chown -R _mysql .
sudo chown -R _mysql .