initdev 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env bash
  2. # This script is a shortcut for configuring newly-build docker container for Misago development
  3. python setup.py develop
  4. # Clear OS files
  5. rm -f /srv/misago/.DS_Store
  6. rm -f /srv/misago/Thumbs.db
  7. # If user specified "-f", clear after previous devinit
  8. if [ "$1" = "-f" ]
  9. then
  10. echo "Cleaned files created by previous initdev"
  11. rm -f /srv/misago/cron.txt
  12. rm -f /srv/misago/manage.py
  13. rm -rf /srv/misago/avatargallery
  14. rm -rf /srv/misago/$PROJECT_NAME
  15. rm -rf /srv/misago/media
  16. rm -rf /srv/misago/static
  17. rm -rf /srv/misago/theme
  18. rm -rf /srv/misago/userdata
  19. fi
  20. # Create new project
  21. python extras/createdevproject.py $PROJECT_NAME /srv/misago
  22. # Clean up unnecessary project files
  23. rm -rf theme
  24. rm -f cron.txt
  25. # Database
  26. ./extras/wait_for_postgres.sh
  27. python manage.py migrate
  28. python extras/createsuperuser.py
  29. # Print short bit of help at the end of cript
  30. RED='\033[0;31m'
  31. DEFAULT='\033[0m'
  32. echo ""
  33. echo "================================================================================"
  34. echo ""
  35. echo "Note: running 'initdev' after already having used it to setup Misago"
  36. echo "for development may result in any of following errors occuring:"
  37. echo ""
  38. echo " - CommandError: /srv/misago/... already exists, overlaying a project or app into an existing directory won't replace conflicting files"
  39. echo " - ModuleNotFoundError: No module named '$PROJECT_NAME'"
  40. echo " - django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the NAME value."
  41. echo " - python: can't open file 'manage.py': [Errno 2] No such file or directory"
  42. echo ""
  43. echo "If you are experiencing either of those errors, this means that files are"
  44. echo "present in the repository's main directory preventing 'initdev' from succedding."
  45. echo "Please try running the 'initdev' with \"-f\" option to force old files deletion:"
  46. echo ""
  47. echo " docker-compose run --rm misago initdev -f"
  48. echo ""
  49. echo -e "${RED}Warning:${DEFAULT} if you have uncommited changes to Misago's setup that should be included"
  50. echo "in next release, make sure that they are commited to 'misago/project_template'"
  51. echo "or 'initdev -f' will overwrite the files causing them to be lost."