'Cannot run a Django app using rc.local and a archive .sh

I am trying to implement an automatic execution of my program on a raspberry, I read some tutorials and they talk about using a file with .sh extension and edit the rc.local file, I already created my file called autorunser.sh and modify the rc.local file, but it does not work, I do not know if I'm doing something wrong, I call the autorunser.sh file with a source autorunser.sh and the program works but my call from the rc.local file does not work.

My code in the rc.local file is this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
source /home/pi/autorunser.sh
exit 0

And my code in the autorunser.sh file is the following:

#!/bin/bash

cd /home/pi/pidjango/market
source ../djenv/bin/activate
python manage.py  runserver 

exit 0


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source