JetBrain

Useful Shortcuts

command + option + ` : Switch among different opened projects  

Join multiple lines’ item to one line.

Ctrl + Shift + J: Click the first item of an array first. Then, Ctrl + Shift + J to move next line to this line

Split one long line’s items to multiple lines.

This is the reverse of Ctrl + Shift + J. You can use Find - Search - Replace feature. E.g. Find - search (,) - replace with (, Enter). The Enter is a press of Enter key.

PyCharm

Open PyCharm, then File -> Open -> select '/path/to/sauron/' -> click 'Open'.

PyCharm for backend

Python Interpreter

PyCharm -> Preferences -> Project:sauron -> Project Interpreter -> Click 'sauron' folder -> Project Interpreter -> Select the correct interpreter.

We suggest reading pyenv-virtualenv for the Python virtualenv.

Enable Django support

PyCharm -> Preferences -> Languages & Frameworks -> Django -> Click 'sauron' folder -> Choose 'Enable Django support'.

  • Set Django project root as /path/to/sauron/api.
  • Set Settings as sauron/settings.
  • Under manager.py tasks, set Environment variables as what you want if you need.
  • Click OK.

Run Django tests

Please read How to run Django tests in PyCharm.

PyCharm for frontend

Node package manager

PyCharm -> Preferences -> Languages & Frameworks -> Node.js & NPM -> Package manager -> Choose 'NPM' (not 'yarn')

Because in this way, we can make the ESLint integrate well with PyCharm.

So please manually run npm install when new package added.

If running npm install changes ./frontend/yarn.lock, then revert the change to still use the original yarn.lock.

Other useful settings

  • Preferences | Editor | Strip trailing spaces on Save | All
  • Preferences | Editor | Code style | Javascript |, use Single Quote in new code.
  • Preferences | Editor | Code style | Javascript | Spaces | Within | ES6 import/export braces (Check it)