Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

McCarthy Code

A portfolio page for Matt McCarthy, a Web and mobile development contractor.


Make sure python3 and pip3 are installed on your system and install virtualenv.

$ sudo apt install -y python3 python3-pip && pip3 install virtualenv

virtualenv's default installation directory is $HOME/.local/bin. Add it to your PATH if it is not already there.

$ echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc && source ~/.bashrc

In the project's root directory, run the following to create a new virtual environment.

$ virtualenv -p python3 env

Activate the newly created environment.

$ source env/bin/activate

At any point within the virtual environment, run deactivate to deactivate.

(env) $ deactivate

Go back to the virtual environment and install project dependencies.

(env) $ pip install -r requirements.txt


Generate a secret key and pipe the output to a file. Change the newly created file's permissions to rw-------, or 600. Note that you will need to add the file to .gitignore if you name it something other than secret.txt (or change the directory in which it is located, or both) and choose to keep it in the repository. If you save the file somewhere other than BASE_DIR/auth and/or name the file something other than secret.txt, change the value of SECRET_KEY_FILE in mwd/ to match your system's directory structure.

$ mkdir auth
$ python > auth/secret.txt
$ sudo chmod 600 auth/secret.txt

Alternatively, export it as an environment variable and edit mwd/ to read the string that way.

$ export SECRET_KEY=$(python

In, change

SECRET_KEY_FILE = '%s/auth/secret.txt' % BASE_DIR
with open(SECRET_KEY_FILE, 'r', encoding='utf8') as f:
    content = f.readline()
SECRET_KEY = content[:-1]


SECRET_KEY = os.environ.get('SECRET_KEY')

No method is more secure than the other as an attacker can access the key both ways if they gain access to the system running the project.

Make and apply migrations.

(env) $ python makemigrations
(env) $ python migrate

Development Mode

To run in development mode, activate the virtual environment and execute the following:

(env) $ python runserver localhost:8000

Production Mode

To run in production mode, follow these steps after choosing your Linux distribution.


Portfolio and biography pages for Matt McCarthy, a full stack Web and mobile app developer.