Remote Deployment using Pycharm

Have you ever wanted to develop a Python or Web application for Linux from your laptop running Windows 7 or MAC OS X? Do you want to run your code that  will be published to whole world but afraid from the dependencies mismatch between your laptop and   production server?

Guess what: all of this is possible with the remote development features already available in PyCharm.


Here’s the deal:

1- You will connect to remote server (production or staging)

2-Once connected, Your local files will be uploaded over SFTP to remote server

3-If your run your code from your local laptop, The Pycharm will use the remote dependencies and remote interpreter to run it not the local (which will eliminate any dependencies mismatch)

Tools Used

1-Pycharm (Popular Python IDE) v4.5 or higher

2-Remote Server (Centos/RHEL/Debian/Ubuntu)

3-Network between them


How to do it

[1]Open Pycharm and from Tools > Deployment > configuration


[2] Provide needed SSH credentials (root/password/IP address) and choose SFTP


if you will connect to Debian/Ubuntu, it may throw the following error “Invalid descendant file name “\””


Click on Advanced and choose Compatibility mode


Then Ignore this error and continue to add

[3] Select the mapping


-Here we will map between the local and remote location. in other word any file found in Local Path(Windows Machine) will be automatically uploaded to Deployment Path (Linux Machine)

[4]Modify the interpreter location (Use the remote interpreter to run your project) from File>Settings>Project Interpreter>Add Remote


[5]Sometimes the server has multiple interpreters and versions (Python2.7, Python2.6 and so on) so you can choose which python interpreter (2.6 or 2.7) needed to be synced by providing it in Python Interpreter Path. to know which python path in linux, you can use “#which python” command


[6] Press Ok and Sync will be in progress. Basically Pycharm is installing some files (PytCharm helpers) on remote machine to allow him to run your code in far-end deployment



[7]-Click on waiting icon to see the currently uploaded, downloaded files from your Deployment server




[8]- Voilà! a new Interpreter is shown in Project Interpreter that use the remote serverclip_image013

Files uploaded on the server


[9]-Now Create a new Interpreter Configuration that point to remote file and remote python interpreter


[10]-If you click Run then a  command will be sent to remote server using SSH to run your script and print the output  (note the use of python 2.6 to run)


[10]-Finally, make sure you choose Automatic upload for your files so any modification will be uploaded automatically clip_image017


[1]-if you’ve multiple Deployment server, You can choose which one will be the default


[2]-you can enforce sync and choose which server you need this file to sync to (Only one destination is allowed)



[3]-However you can upload the file to another Deployment server



[4]-You can explore the contents of remote server just like the WinSCP



Wrapping Up

Trying to replicate the production environment to your development machine has been always a problem in DevOps world. A projects like Vagrant , Docker and Puppet launched in order to solve these problems. However it will take some time till being matured  and familiar for everyone . The above method is trying to solve this problem and run your code using the same dependencies in production network to eliminate the #1 reason on the below comic 😀


5 thoughts on “Remote Deployment using Pycharm

Share you opinion to benefit others :)

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s