initdev 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. fi
  19. # Create new project
  20. python extras/createdevproject.py $PROJECT_NAME /srv/misago
  21. # Clean up unnecessary project files
  22. rm -rf theme
  23. rm -f cron.txt
  24. # Database
  25. ./extras/wait_for_postgres.sh
  26. python manage.py migrate
  27. python extras/createsuperuser.py
  28. # Print short bit of help at the end of cript
  29. RED='\033[0;31m'
  30. DEFAULT='\033[0m'
  31. echo ""
  32. echo "================================================================================"
  33. echo ""
  34. echo "Note: running 'initdev' after already having used it to setup Misago"
  35. echo "for development may result in any of following errors occuring:"
  36. echo ""
  37. echo " - CommandError: /srv/misago/... already exists, overlaying a project or app into an existing directory won't replace conflicting files"
  38. echo " - ModuleNotFoundError: No module named '$PROJECT_NAME'"
  39. echo " - django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the NAME value."
  40. echo " - python: can't open file 'manage.py': [Errno 2] No such file or directory"
  41. echo ""
  42. echo "If you are experiencing either of those errors, this means that files are"
  43. echo "present in the repository's main directory preventing 'initdev' from succedding."
  44. echo "Please try running the 'initdev' with \"--f\" option to force old files deletion:"
  45. echo ""
  46. echo " docker-compose run --rm misago initdev --f"
  47. echo ""
  48. echo -e "${RED}Warning:${DEFAULT} if you have uncommited changes to Misago's setup that should be included"
  49. echo "in next release, make sure that they are commited to 'misago/project_template'"
  50. echo "or 'initdev --f' will overwrite the files causing them to be lost."