amr_aly

Activate_env_run_the_project_then_open_the_browser

May 12th, 2021 (edited)
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.30 KB | None | 0 0
  1. ## On windows
  2. ####################################################################
  3. @ECHO OFF
  4. # open command, activate your 'env' my 'env called' (salesenv)
  5. # then run the project by manage.py command
  6. start cmd.exe /k "D:\Django\win_envs\salesenv\Scripts\activate && cd D:\Django\projects\stock\stockapp\kmastock\ && python manage.py runserver 0.0.0.0:8000"
  7. # open Opera browser on windows 10
  8. start C:\Users\Root\AppData\Local\Programs\Opera\launcher.exe "http://localhost:8000"
  9.  
  10. ##################################################################################
  11.  
  12.  
  13. ## On Linux
  14. ##################################################################################
  15. #!/bin/bash
  16. # activate the virtualenv
  17. source ~/Django_envs/eventenv/bin/activate
  18. # Restart Database service
  19. /etc/init.d/postgresql restart
  20. echo '.......... Activating the virtualenv..'
  21. echo '.................'
  22. echo '..Then execute main files'
  23. # Check if database is prepared
  24. python ~/challenge/mysite/manage.py makemigrations --settings=mysite.settings
  25. python ~/challenge/myproject/manage.py migrate --settings=mysite.settings
  26. # Collect static files
  27. python ~/challenge/mysite/manage.py collectstatic --settings=mysite.settings
  28. # execute the manage.py file
  29. python ~/challenge/mysite/manage.py runserver 0.0.0.0:8005 --settings=mysite.settings
  30.  
Add Comment
Please, Sign In to add comment