logging_1.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. def set():
  2. if not os.path.exists(settings.MEDIA_ROOT):
  3. try:
  4. os.mkdir(settings.MEDIA_ROOT)
  5. except OSError:
  6. return
  7. if not os.path.exists(settings.MEDIA_ROOT+'/download'):
  8. try:
  9. os.mkdir(settings.MEDIA_ROOT+'/download')
  10. except OSError:
  11. return
  12. if not os.path.exists(settings.BASE_DIR + "/log"):
  13. try:
  14. os.mkdir(settings.BASE_DIR + "/log")
  15. except OSError:
  16. return
  17. if not os.path.exists(settings.BASE_DIR + "/log/message"):
  18. try:
  19. os.mkdir(settings.BASE_DIR + "/log/message")
  20. except OSError:
  21. return
  22. if not os.path.exists(settings.BASE_DIR + "/log/error"):
  23. try:
  24. os.mkdir(settings.BASE_DIR + "/log/error")
  25. except OSError:
  26. return
  27. if not os.path.exists(settings.BASE_DIR + "/log/log"):
  28. try:
  29. os.mkdir(settings.BASE_DIR + "/log/log")
  30. except OSError:
  31. return
  32. if not os.path.exists(settings.MEDIA_ROOT + "/tgbot"):
  33. try:
  34. os.mkdir(settings.MEDIA_ROOT + "/tgbot")
  35. except OSError:
  36. return