Skip to content

Instantly share code, notes, and snippets.

@mildcore
Last active April 30, 2020 03:29
Show Gist options
  • Save mildcore/62a7d72b2ad3d0193e3f6f365cd9c8de to your computer and use it in GitHub Desktop.
Save mildcore/62a7d72b2ad3d0193e3f6f365cd9c8de to your computer and use it in GitHub Desktop.

1. Editor -> File and Code Templates -> Python Scripts

#!usr/bin/python3
# -*- coding: utf-8 -*-

"""
@file:${NAME}.py
@time:${YEAR}/${MONTH}/${DAY}
@author:${USER}
"""

2. Editor -> Live Templates

a> #head,  shebang & coding
#!/usr/bin/python3
# -*- coding: utf-8 -*-

b> #head_with_doc,  file time author
Variable Expression Skip if define
NAME fileName()
DATE date()
USER user()
#!usr/bin/python3
# -*- coding: utf-8 -*-

"""
@file: $NAME$
@time: $DATE$
@author: $USER$
"""

3. Editor -> Language Injections -> ▢ python: "SQL select/delete/insert/update/create"

deactivate the sql injections info in *.py

4. Project -> Project Structure -> mark a dir as sources

or just right-click a dir in the project-window to mark it as sources. by doing so, you could fix python module import problems in pycharm.

for example:

web-project
    |www
         |app.py 
         |orm.py

we could use import orm in app.py after www marked as sources, while only from www import orm is valid before that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment