To further develop this project, a copy can be made using the following steps:
My database is hosted on ElephantSQL. But you could host your PostgreSQL database wherever. These steps outline the process of the creation of a new database on ElephantSQL.
- Login or sign up to ElephantSQL.
- Once you have an account click the green Create New Instance button, or click here.
- Name your database.
- Keep the default plan selected. The Tiny Turtle (Free) plan is adequate.
- Click the green Select Region button.
- Choose a region local to you.
- Click the green Review button.
- Confirm the shown details are correct then finish by clicking the green Create Instance button.
- From the list of instances select your newly created database.
- Make note of the URL - you will need this later.
Static and media files are hosted on Cloudinary, an online host and API provider for all kinds of media adjustments.
- Login or sign up to Cloudinary.
- Navigated to your Dashboard.
- Make note of your API Environment Variable for later.
Forking will create a copy of my original repository on your own GitHub account.
- Login or sign up to GitHub.
- Locate this GitHub repository.
- Click the Fork button at the top right of the page.
- You will now have a copy on your GitHub account.
If you want to edit any of the files I would suggest using Gitpod - a browser based IDE.
- Install the Gitpod browser extension.
- Locate your copy of the repository.
- Click the new green GitPod button above the file list.
- Login to Gitpod with your GitHub account.
- Requirements will automatically be installed thanks to requirements.txt.
- In the terminal window type
touch env.py
to create your environmental variables file. - Enter the following into the empty env.py file:
import os
os.environ["DATABASE_URL"] = "YOUR ELEPHANTSQL URL FROM EARLIER"
os.environ["SECRET_KEY"] = "A SECRET KEY"
os.environ["CLOUDINARY_URL"] = "YOUR CLOUDINARY URL FROM EARLIER (without the CLOUDINARY_URL= at the start)"
os.environ["EMAIL_USER"] = "A GMAIL EMAIL ADDRESS"
os.environ["EMAIL_PASSWORD"] = "THE EMAIL PASSWORD"
- Before you commit any changes back to GitHub remember to create a .gitignore file by typing
touch .gitignore
into the terminal. - Add
env.py
to .gitignore. - To set up your database type
python manage.py makemigrations
in the terminal, thenpython manage.py migrate
. - Type
python manage.py createsuperuser
into the terminal window and follow the instructions to create your first admin user. - To run the server type
python manage.py runserver
.
Squigl is currently deployed to Heroku. Follow these steps if you want to deploy your copy.
- Login or sign up to Heroku.
- Once on your Dashboard, click the New and Create New App buttons.
- Enter a name for your app and your local region.
- Click Create App.
- Click Settings.
- Click Reveal Config Vars.
- Enter the following environmental variables - these are the same as in env.py if you followed the Gitpod steps:
Key | Value |
---|---|
DATABASE_URL | YOUR ELEPHANTSQL URL FROM EARLIER |
SECRET_KEY | A SECRET KEY |
CLOUDINARY_URL | YOUR CLOUDINARY URL FROM EARLIER (without the CLOUDINARY_URL= at the start) |
EMAIL_USER | A GMAIL EMAIL ADDRESS |
EMAIL_PASSWORD | THE EMAIL PASSWORD |
- Click Deploy from the menu.
- Click GitHub - Connect to GitHub, and if prompted to login to GitHub.
- In the repo-name box type the name of your fork from earlier.
- Click Search.
- Click Connect next to the correct repository.
- Scroll to the bottom and click Deploy Branch.
- Pay attention to the log and look out for any errors.
- If it was successful your app will now be live.