Django, Apache2, Sublime Text 3 build system and developing process.

At first be sure that you are using this path to run pure apache:

This topic for those who wants to develop ON THE FLY with python and django and do not want to manually restart dev server each time when code changes AND you don’t like built in python web-server and want to run your dev site as it should run on apache.

Sublime Text 3

I use it for fast code changing and writting because PyCharm can’t work fine with multiline carrets, for example. Also PyCharm is too heavy when you want just copy&paste some features and see how it work on web. So my PyCharm will be used for debug purposes.

I hope you know what is the «Build system» in Sublime, if no — read this first:

  1. Should run Sublime text 3 «as Administrator»
    1. You can run it once with Shift + Left mouse
    2. You can switch settings on sublime_text.exe (Compatibilities -> Always run as Admin.)
  2. Then in Sublime: Tools -> Build System -> New Build System
    1. In opened file just copy&pase my example content
    2. Change paths to your programms: Chrome, IE etc…
    3. Save file with name like Apache.sublime-build
  3. Create .bat files from my examples
    1. Place it where you want 
    2. Changes paths in build file to correspond bat file for each option you want
  4. Use simply with Ctrl + Shift + P type «name» of your build option.

If there is no Build system (Apache in my example)  added in list: Tools -> Build System — it happened because build file is not in place: 

  • C:\Users\Username\AppData\Roaming\Sublime Text 3\Packages\User\Apache.sublime-build

If Build system is in the list, but not in console (Ctrl + Shift + P -> Build With Apache…) — it means that build file has a syntax error, check every bracket and comma from my example.

Bat files

I have different options for build:

  • Can restart apache — only from cmd with Sublime
  • Can restart apache via .bat with Sublime
  • Can restart apache via .bat AND open http://adress in web-browser
    • restarting apache and open link can be used via bat only, I did no found the way to open it in sublime-build options

So, when you compose .bat file for open address after apache restarted — use command-line args in bat: 

 And then add this args (url paths) to build option:

 That’s all!

When everything is fine — after you choose any build option — Apache will be restarted and web-browser will open page you want.








Об авторе trianglesis

Александр Брюндтзвельт - гений, филантроп, 100 гривен в кармане. Этот блог - "сток" моих мыслей и заметок. Достаточно одного взгляда на него, чтобы понять, что такой же бардак творится у меня в голове. Если вам этот бардак интересен - милости прошу.
Закладка Постоянная ссылка.

Комментарии закрыты