This repository is for storing the server-side code which powers OurJSEditor.com.
Note: This is to get a full database and Django setup working. If you want to work on the editor itself, it's over here. If you are only tweaking JS/CSS or fixing a small python bug you probably don't need a whole server to test it.
This code is written to run on a server, so there's some setup involved to make it run locally. It's still easier than trying to install the full dependencies for the server, however.
The following instructions have been tested on MacOS, but should translate well to Linux. Windows setup should be roughly similar, but will probably require some searching.
- Clone this repository.
git clone https://github.com/OurJSEditor/OurJSEditor.git
- Move into the new directory,
cd OurJSEditor
. That's pretty straightforward, I hope. - Make sure you have python 2.7 (& pip) installed (
python -V; pip -V
), and install them if you don't. virtualenv
creates a virtual environment for each one of your python projects so you don't have conflicts. Runpip install virtualenv
.- Inside the OurJSEditor directory, create a virtual environment with
virtualenv OurEnv
. The name doesn't really matter, but OurEnv is ignored in.gitignore
for you. - Activate the virtual environment with
source OurEnv/bin/activate
. Once it's activated, you should see(OurEnv)
appended to the front of your terminal prompt. Usedeactivate
at any time to exit the virtual environment. - Now, installing requirements. Running
pip install -r requirements.txt
install the correct versions of a list of python requirements. - Make sure you have sqlite installed (
sqlite3 -version
). The server uses mySQL, but it's far easier to set upsqlite3
for local development. - There are a few settings that need to be changed, that are loaded from the
.env
file. There is a basic example of the settings needed for a local server in the.env.local
file. Rename that to.env
so Django can find it:
cp django_code/.env.local django_code/.env
- The frontend of the website is a relatively separate Preact framework, managed with npm and webpack.
- Make sure you have node (& npm) installed (
npm -v
), and install them if you don't. - Run
npm install
to install JS requirements. - Use
npm run build
to build the build the frontend. - Run database migrations.
python django_code/manage.py migrate
- Start up a server!
python django_code/manage.py runserver
. You should now see you own copy of the website at http://localhost:8000, complete with the ability to create and edit users and stuff! You can stop following these instructions now.
After following these instructions, you can use ctrl+C to stop the server and deactivate
to exit the virtual environment.
Then, to start the server again, re-activate the virtual environment and use python django_code/manage.py runserver
.