Sign in

How to run Django tests in PyCharm?

PyCharm has facilitated Django (and Django Rest Framework) tests by:

But if you click it, you will got some errors. That is because you haven’t configured it well.

First, we need to configure the Django tests template, click Run -> Edit configurations , them click the `wrench` icon, like this:


When using PyCharm, I need to make ESLint working alright. When I run yarn run eslint, I got

Error: Failed to load parser 'babel-eslint' declared in '.eslintrc.yml': Your application tried to access babel-eslint, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

Then I need to make sure I have run npm install before to make sure all the folders I need under node_modules have been generated(including the missed babel-eslint).

Then I can run npm run eslint now.


If you are developing branch new-feature, and made a commit my commit.Someone else pushed to master.

Then you can do these to prevent generating this information (Merge branch ‘master’ of github.com:example/your_repo into new-feature).

git checkout new-feature
git pull --rebase origin master

Something git clone is too slow.

You can accelerate it by setting bash shell:

export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087; ,

and then start ShadowSocks .

Then git clone https://github.com/your/repo.git . Remember to use https: instead of git@ .


# Run the content of a file in current shell. '.' is the same as 'source'.
. filename [arguments]
source filename [arguments]
# Add an env variable 'PYENV_ROOT' in current shell.
export PYENV_ROOT="$HOME/.pyenv"

Use Homebrew to install pyenv.

https://github.com/pyenv/pyenv#homebrew-on-macos

Then brew install pyenv-virtualenv. Then config fish by vim ~/.config/fish/config.fish.

set -x PYENV_ROOT $HOME/.pyenv
status --is-interactive; and pyenv init - | source
status --is-interactive; and pyenv virtualenv-init - | source

Here are some useful commands.

pyenv versions
pyenv install -l
pyenv install 3.8.1
pyenv global 3.8.1
pyenv which…

Here are some helpful shortcuts of fzf.

control + r # For searching history command
control + t # For searching files

Mac user can install https://iterm2.com/ .

Is is too slow when installing some packages or downloading something? Maybe you should set proxy for your Terminal. If you are using ShadowSocks, you can type this at your Terminal

export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;

1. Click ‘App Store’ and click the account on the right top.

2. Input the ‘Apple ID’ and ‘Password’. If the account’s area is not the area of the current App Store’s area, the App Store will prompt a dialog asking you whether switching to that App Store area.

Lane

Ruby, JavaScript and Python developer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store