title: Starting virtualenv script rc local
body: <p>I'm very newbie in this field and hope someone can help me.</p>
  
  <p>So I have a backend project which I need to launch automatically when the computer switches on (I really don't care how, using systemd or rc.local, my boss told me rc.local, but I guess either will do). I just need to start a docker container, then start my virtualenv and then run the project.</p>
  
  <p>So far I've tried this at <code>/etc/rc.local</code></p>
  
  <p><code>docker start cassandratt #my docker container
  sleep 20 #an ugly hack to give time for the container to start
  cd /home/backend/
  . venv/bin/activate
  . /run.py</code></p>
  
  <p>It doesn't work, but the docker container starts, so I guess the problem is around virtualenv or python, I really don't know as I don't have any experience on this field. </p>
  
  <p>Any idea on how I could accomplish it? </p>
  
  <p>Thanks in advance</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Following Samer's guidance I tried creating a folder after activating the virtualenv and it created fine, so I suppore the problem is trying to execute run.py, perhaps loading the virtualenv's python? </p>
  
  <p><code>docker start cassandratt #my docker container
  cd /home/backend/
  . venv/bin/activate
  mkdir test #folder created fine
  . /run.py
  mkdir test2 #folder not created</code></p>