Export/Import Django project settings in PyCharm - django

Actually I have project with about 20 settings (Django server, Django tests, fabric tasks). Now I want to move my environment to other computer.
Is it possible to migrate all these configurations or should I create manually one by one in new PyCharm instance?

Yes there is. What you need to do, is copy everything in your project directory, including .idea folder, and pasting it to the new place that you want to place it.
Now, all you have to do is open the directory as a project using PyCharm in your new workstation.

Related

Pycharm not recognizing Django project

I've seen similar questions but they don't solve my problem.
I have a correctly installed django project. I haven't being able to make Pycharm recognize it. I can't get file name completions (i.e static files), imports from the project apps aren't recognized and neither are urls tags, can't run the server ... How can I solve this?
The problem was that I wasn't selecting the correct folder when opening the project. I opened the whole virtualenv folder with Pycharm cause I wanted quick access to the activate file in /bin where I keep my environment variables.
The solution was to delete the .idea folder and open the specific django project folder. I thought there was a workaround to this but there wasn't. The question still remains if there is a way to add the activate file in the /bin directory of the virtualenv to the project, even if it is outside the project root.

What do I need to do in preparation for cloning a django repository?

Assuming the django project repository is on github and I have had no interaction with it previously.
So: I cd to a new directory on my computer.
I clone the repository.
If the django project is using postgresql, do I have to have postgresql installed on my local machine?
Do I have to be running in a virtual environment to use a specific interpreter?
Thanks Peter
Database
You can actually use another database on your local copy if you choose, although in general it's a good idea to use the same database locally.
If you're going to be using postgres locally, yes you'll need to install it and then create your local database. Once you have your local database setup, you'll need to change some config values of your DATABASES property in settings.
Packages
Your project will also have some dependencies which should be listed in a requirements.txt file at the root directory. If it is not, you'll need to find out which packages need to be installed via pip freeze in the production console.
Virtual Env
You should use a virtual environment, but it's not completely necessary to get your project up and running. Virtualenvs allow you to have different installs and runtimes for different projects.
Other
Every project is different, and there will most likely be some other things that pop up. However, this should get you going in the right direction.

What is the .idea folder?

When I create a project in JetBrains WebStorm, a folder called .idea gets created. Is it okay if I delete it? Will it affect my project?
When you use the IntelliJ IDE, all the project-specific settings for the project are stored under the .idea folder.
Project settings are stored with each specific project as a set of xml
files under the .idea folder. If you specify the default project
settings, these settings will be automatically used for each newly
created project.
Check this documentation for the IDE settings and here is their recommendation on Source Control and an example .gitignore file.
Note: If you are using git or some version control system, you might want to set this folder "ignore".
Example - for git, add this directory to .gitignore. This way, the application is not IDE-specific.
There is no problem in deleting this. It's not only the WebStorm IDE creating this file, but also PhpStorm and all other of JetBrains' IDEs.
It is safe to delete it but if your project is from GitLab or GitHub then you will see a warning.
As of year 2020, JetBrains suggests to commit the .idea folder.
The JetBrains IDEs (webstorm, intellij, android studio, pycharm, clion, etc.) automatically add that folder to your git repository (if there's one).
Inside the folder .idea, has been already created a .gitignore, updated by the IDE itself to avoid to commit user related settings that may contains privacy/password data.
It is safe (and usually useful) to commit the .idea folder.
It contains your local IntelliJ IDE configs. I recommend adding this folder to your .gitignore file:
# intellij configs
.idea/
The reason my device was not being recognized was because my emulator was frozen.
What helped me was to wipe my emulator's data.
Android Emulator freezes
Checkout #gimme-the-411 's comment on this thread.

I've installed django on dreamhost using passenger_wsgi now how do I export my development project onto this?

I followed the wiki on http://wiki.dreamhost.com/Django .
Django is installed in my site's directory and I've even created my first project, now what do I do ?
You can copy your project files to the server and transfer your database to the sql server on dreamhost. Don't forget to make changes in your settings.py to reflect the environment. Should work otherwise me thinks.

Django Deployment Advice

I have a multi-step deployment system setup, where I develop locally, have a staging app with a copy of the production db, and then the production app. I use SVN for version control.
When deploying my production app I have been just moving the urls.py and settings.py files up a directory, deleting my django app directory with rm -rf command and then doing an svn export from the repository which creates a new django app directory with my updated code. I then move my urls.py and settings.py files back into place and everything works great.
My new problem is that I am now storing user uploads in a folder inside of my django app, so I can't just remove the whole app dir anymore or I would loose all of my users files.
What do you think my best approach is now? Would svn export --force work, since it should just be overwriting all of my changed files? Should I take an entirely new approach? I am open to advice?
You may want to watch this presentation by Jacob. It can help you improve your deployment process.
I use Bitbucket as my repo and I can simply perform push on my Dev box and run pull/update on Stage/Prod box. Actually I don't run them manually, I use fabric to do them for me :).
Your could use rsync or something similar to backup your uploaded files and use this backup when you deploy your project.
For deployment you could try to use buildout:
http://www.buildout.org/
http://pypi.python.org/pypi/djangorecipe
http://jacobian.org/writing/django-apps-with-buildout/
For other deployment methods see this question:
Django deployment tools
You can move your files to S3 servers (http://aws.amazon.com/s3/), so you will not ever have to care about moving them with your project.