How to transfer django projects from one pc to another

4,326 views
Skip to first unread message

computer engineering Forum

unread,
Dec 10, 2018, 2:14:07 PM12/10/18
to Django users
I want to change my pc but i fear i wont be able to access the projects

Swetank Subham Roy

unread,
Dec 10, 2018, 2:54:41 PM12/10/18
to django...@googlegroups.com
1. Make requirement file let's say requirement.txt using pip freeze command, which keep records of packages used in the project.
2. Make a copy of project folder to the new machine.
3. Create virtual environment on new machine.
4. Activate and install package from requirement.txt file to the virtual environment.
5. Configure database and other settings in settings.py of project.
6. Run makemigrations followed by migrate command.
7. Run run server command.

All done.

On Tue 11 Dec, 2018, 12:43 AM computer engineering Forum <robinso...@gmail.com wrote:
I want to change my pc but i fear i wont be able to access the projects

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/72f991a7-4024-4a37-80f5-5f5604c7a391%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon A

unread,
Dec 10, 2018, 8:03:10 PM12/10/18
to Django users
if you are really lazy, you can just zip your whole project. then transfer to another machine.

I transfer my projects from work (using windows) to home (using ubuntu) then vice versa. I only had to manually install the necessary packages will be notified to you when you need to get them installed when you try to run the server.

Also if you be using a different set of database, then that's another set of configuration.

Mike Dewhirst

unread,
Dec 10, 2018, 8:19:49 PM12/10/18
to django...@googlegroups.com
On 11/12/2018 12:03 PM, Simon A wrote:
> On Tuesday, December 11, 2018 at 3:14:07 AM UTC+8, computer
> engineering Forum wrote:
>
> I want to change my pc but i fear i wont be able to access the
> projects
>

I would assume my new pc is going to fail five minutes after I
successfully transfer projects. Therefore I suggest that you start from
scratch on the new pc with that in mind.

It (for me) involves ...

- a repository for each project

- a set of scripts for dumping various Postgres databases

- another set of scripts for dropping/creating/loading various databases
from dump files

- a backup facility

- never manually installing software (if possible) but rather writing a
script to do the installing. After running the script to install
whatever I then comment out that line. Then for the inevitable
replacement machine if I have backed up that script I only need to
uncomment all (or most) lines and hey presto - a good start. I also keep
comments in that install script to jog my memory to do stuff.

A new machine is an opportunity to improve your systems.

ymmv

Ira Abbott

unread,
Dec 12, 2018, 7:00:29 PM12/12/18
to Django users
This works for sqlite.  postgre, etc. you have to do as above.

Ira Abbott

unread,
Dec 12, 2018, 7:06:14 PM12/12/18
to Django users
If DB is local postgres, or mysql, export data on old machine and import on the other after migration.  This may takes some experimentation to get keys importing properly.

If external and managed (say RDS), then migrations are not needed - the DB is already there and populated.  The above export / import applies when migrating that though.
Reply all
Reply to author
Forward
0 new messages