简体   繁体   English

我应该如何将 Django 项目上传到 GitHub?

[英]How should I upload a Django project to GitHub?

This is probably a very dumb question.这可能是一个非常愚蠢的问题。 But I have a little project in Django and I would like to upload it to GitHub to just have it there.但是我在Django 中有一个小项目,我想将它上传到 GitHub 以便将它放在那里。 I know how GitHub works and I know how to upload the project .我知道 GitHub 是如何工作的,我知道如何上传项目 But I'm wondering if just uploading the whole folder is the right way to do it.但我想知道上传整个文件夹是否是正确的方法。 I mean.我的意思是。 I have a data base with my project, that has some information.我的项目有一个数据库,里面有一些信息。 So is the database JUST in my computer right?那么数据库就在我的电脑里吗? It won't get uploaded next to the project to github?它不会在项目旁边上传到github吗?

So basically I'm asking:所以基本上我问:

  1. Should I just simply upload the whole folder?我应该简单地上传整个文件夹吗?
  2. And if I were to download my project from GitHub from another computer.如果我要从另一台计算机上的 GitHub 下载我的项目。 Should I just have to run migrations to make it work locally?我是否应该只需要运行迁移才能使其在本地工作?

Don't push your settings.py into a repository, because it has some important information about your application such as SECRET_KEY OR DATABASE .不要将您的settings.py推送到存储库中,因为它包含有关您的应用程序的一些重要信息,例如SECRET_KEY OR DATABASE

It's important to keep your application credentials like API Keys , Amazon S3 , email parameters, database parameters safe, specially if it's an open source repository.确保您的应用程序凭证(如API 密钥Amazon S3电子邮件参数、数据库参数的安全)非常重要,特别是如果它是一个开源存储库。

You need to make sure that these kind of information will be stored in a secure place and don't push it into a public repository.您需要确保将这些类型的信息存储在安全的地方,而不是将其推送到公共存储库中。

There are more files that you shouldn't push into your repository.还有更多文件不应该推送到存储库中。 check out this link to know more about .gitignore files in Django projects.查看此链接以了解有关 Django 项目中.gitignore文件的更多信息。 also there is a website that you can create your .gitignore files automatically.还有一个网站,您可以自动创建.gitignore文件。

Now if you want to know more about how to store these kind of informations you can use environment variables and also there is a package called python-decouple that you can use it for storing your important informations.现在,如果您想了解更多有关如何存储此类信息的信息,您可以使用environment variables ,并且还有一个名为python-decouple的包,您可以使用它来存储您的重要信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM