Errors Encountered Setting Up Django Project

I recently got a project, based in Django. Like all new project, I had to set up the development environment before working on it. The post is about issues I troubleshoot while setting up the development environment:

  • Python Virtual Environment: When a tool like virtualenv is setting up a virtual environment, it creates it base on the computer’s Python version unless we specify a different version in the command. The project was Python 2.7, so the setup encountered errors because my computer use Python 3 natively. If you are not sure what Python your computer is running on, a simple python –version will show it. To ensure there are no error, I use the command virtualenv -p python2.7 venv.
  • OS & Package Dependencies: Apparently Linux require manually installing several dependencies for matplotlib & scipy. At least according to the project README, which was written for Linux. As MacOS user, I didn’t have to worry about that.
  • Compiler in OS: I do, however, have to worry about command invocation not finding my compiler when I doing npm install. To resolve, use command CXX=clang++ npm install.
  • dyld: Library not loaded: executable_path/../.Python” => Homebrew & Python Path: The errors occurs after ./ runserver, and it is a result of broken Python symlink after a Homebrew update I did for another project. Here are the steps to resolve:
    1. Deactivate the virtual environment.
    2. Upgrade the virtual environment tools. In my case, I did pip install –upgrade virtualenv and pip install –upgrade virtualenvwrapper.
    3. Delete broken symlink using find venv -type l -delete while inside the project directory.
    4. Now redo the virtual environment set up. In my case, it was virtualenv -p python2.7 venv => source venv/bin/activate => pip install -r requirements.txt.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.