{"title":"Jak zaktualizować Django do nowszej wersji","version":"6.1","locale":"pl","docname":"howto/upgrade-version","url":"/pl/6.1/howto/upgrade-version/","canonical":"https://djangodocs.dev/pl/6.1/howto/upgrade-version/","summary":"Upgrading Django to the latest version offers several benefits: New features and improvements become available. Naprawione błędy. Older versions of Django…","html":"<h1>Jak zaktualizować Django do nowszej wersji<a class=\"heading-anchor\" href=\"#how-to-upgrade-django-to-a-newer-version\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Upgrading Django to the latest version offers several benefits:</p>\n<ul class=\"simple\">\n<li><p>New features and improvements become available.</p></li>\n<li><p>Naprawione błędy.</p></li>\n<li><p>Older versions of Django eventually stop receiving security updates\n(see <a class=\"reference internal\" href=\"/pl/6.1/internals/release-process/#supported-versions-policy\"><span class=\"std std-ref\">Supported versions</span></a>).</p></li>\n<li><p>Upgrading with each new release helps keep your code base current and makes\nfuture upgrades smoother.</p></li>\n</ul>\n<aside class=\"admonition-tools-to-help-with-version-upgrades admonition\">\n<p class=\"admonition-title\">Tools to help with version upgrades</p>\n<p>Django has a vibrant ecosystem. There are automated upgrade helpers\nhighlighted on the <a class=\"reference external\" href=\"https://www.djangoproject.com/community/ecosystem/#upgrade-utilities\">Community Ecosystem</a>\npage.</p>\n</aside>\n<p>Here are some things to consider to help make your upgrade process as smooth as\npossible.</p>\n<section id=\"required-reading\">\n<h2>Wymagane Czytanie<a class=\"heading-anchor\" href=\"#required-reading\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>If it’s your first time doing an upgrade, it is useful to read the <a class=\"reference internal\" href=\"/pl/6.1/internals/release-process/\"><span class=\"doc\">guide\non the different release processes</span></a>.</p>\n<p>Afterward, you should familiarize yourself with the changes that were made in\nthe new Django version(s):</p>\n<ul class=\"simple\">\n<li><p>Read the <a class=\"reference internal\" href=\"/pl/6.1/releases/\"><span class=\"doc\">release notes</span></a> for each «final» release from\nthe one after your current Django version, up to and including the version to\nwhich you plan to upgrade.</p></li>\n<li><p>Look at the <a class=\"reference internal\" href=\"/pl/6.1/internals/deprecation/\"><span class=\"doc\">deprecation timeline</span></a> for the\nrelevant versions.</p></li>\n</ul>\n<p>Pay particular attention to backwards incompatible changes to get a clear idea\nof what will be needed for a successful upgrade.</p>\n<p>If you’re upgrading through more than one feature version (e.g. 2.0 to 2.2),\nit’s usually easier to upgrade through each feature release incrementally\n(2.0 to 2.1 to 2.2) rather than to make all the changes for each feature\nrelease at once. For each feature release, use the latest patch release (e.g.\nfor 2.1, use 2.1.15).</p>\n<p>The same incremental upgrade approach is recommended when upgrading from one\nLTS to the next.</p>\n</section>\n<section id=\"dependencies\">\n<h2>Zależności<a class=\"heading-anchor\" href=\"#dependencies\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>In most cases it will be necessary to upgrade to the latest version of your\nDjango-related dependencies as well. If the Django version was recently\nreleased or if some of your dependencies are not well-maintained, some of your\ndependencies may not yet support the new Django version. In these cases you may\nhave to wait until new versions of your dependencies are released.</p>\n</section>\n<section id=\"resolving-deprecation-warnings\">\n<h2>Radzenie sobie z ostrzeżeniami o deprecjacji<a class=\"heading-anchor\" href=\"#resolving-deprecation-warnings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Before upgrading, it’s a good idea to resolve any deprecation warnings raised\nby your project while using your current version of Django. Fixing these\nwarnings before upgrading ensures that you’re informed about areas of the code\nthat need altering.</p>\n<p>In Python, deprecation warnings are silenced by default. You must turn them on\nusing the <code class=\"docutils literal notranslate\"><span class=\"pre\">-Wa</span></code> Python command line option or the <span class=\"target\" id=\"index-0\"></span><a class=\"reference external\" href=\"https://docs.python.org/3/using/cmdline.html#envvar-PYTHONWARNINGS\" title=\"(w Python v3.14)\"><code class=\"xref std std-envvar docutils literal notranslate\"><span class=\"pre\">PYTHONWARNINGS</span></code></a>\nenvironment variable. For example, to show warnings while running tests:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-0-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span>python<span class=\"w\"> </span>-Wa<span class=\"w\"> </span>manage.py<span class=\"w\"> </span><span class=\"nb\">test</span>\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-0-windows-label\">Windows</p><div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows shell\"><code><span class=\"gp\">...\\&gt;</span> py -Wa manage.py test\n</code></pre></div></div></div>\n<p>If you’re not using the Django test runner, you may need to also ensure that\nany console output is not captured which would hide deprecation warnings. For\nexample, if you use <a class=\"reference external\" href=\"https://docs.pytest.org/\">pytest</a>:</p>\n<div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span><span class=\"nv\">PYTHONWARNINGS</span><span class=\"o\">=</span>always<span class=\"w\"> </span>pytest<span class=\"w\"> </span>tests<span class=\"w\"> </span>--capture<span class=\"o\">=</span>no\n</code></pre></div>\n<p>Rozwiąż wszelkie ostrzeżenia o deprecjacji z obecną wersją Django przed kontynuowaniem procesu aktualizacji.</p>\n<p>Third party applications might use deprecated APIs in order to support multiple\nversions of Django, so deprecation warnings in packages you’ve installed don’t\nnecessarily indicate a problem. If a package doesn’t support the latest version\nof Django, consider raising an issue or sending a pull request for it.</p>\n</section>\n<section id=\"installation\">\n<h2>Instalacja<a class=\"heading-anchor\" href=\"#installation\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Once you’re ready, it is time to <a class=\"reference internal\" href=\"/pl/6.1/topics/install/\"><span class=\"doc\">install the new Django version</span></a>. If you are using a <a class=\"reference external\" href=\"https://docs.python.org/3/library/venv.html#module-venv\" title=\"(w Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">virtual</span> <span class=\"pre\">environment</span></code></a> and it\nis a major upgrade, you might want to set up a new environment with all the\ndependencies first.</p>\n<p>Jeśli zainstalowałeś Django z <a class=\"reference external\" href=\"https://pip.pypa.io/\">pip</a>, możesz użyć flagi <code class=\"docutils literal notranslate\"><span class=\"pre\">--upgrade</span></code> lub <code class=\"docutils literal notranslate\"><span class=\"pre\">-U</span></code>:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-1-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span>python<span class=\"w\"> </span>-m<span class=\"w\"> </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>-U<span class=\"w\"> </span>Django\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-1-windows-label\">Windows</p><div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows shell\"><code><span class=\"gp\">...\\&gt;</span> py -m pip install -U Django\n</code></pre></div></div></div>\n</section>\n<section id=\"testing\">\n<h2>Testowanie<a class=\"heading-anchor\" href=\"#testing\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>When the new environment is set up, <a class=\"reference internal\" href=\"/pl/6.1/topics/testing/overview/\"><span class=\"doc\">run the full test suite</span></a> for your application. Again, it’s useful to turn\non deprecation warnings on so they’re shown in the test output (you can also\nuse the flag if you test your app manually using <code class=\"docutils literal notranslate\"><span class=\"pre\">manage.py</span> <span class=\"pre\">runserver</span></code>):</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-2-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span>python<span class=\"w\"> </span>-Wa<span class=\"w\"> </span>manage.py<span class=\"w\"> </span><span class=\"nb\">test</span>\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-2-windows-label\">Windows</p><div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows shell\"><code><span class=\"gp\">...\\&gt;</span> py -Wa manage.py test\n</code></pre></div></div></div>\n<p>After you have run the tests, fix any failures. While you have the release\nnotes fresh in your mind, it may also be a good time to take advantage of new\nfeatures in Django by refactoring your code to eliminate any deprecation\nwarnings.</p>\n<p>If you are upgrading to an alpha, beta, or release candidate, please see our\nguide on <a class=\"reference internal\" href=\"/pl/6.1/internals/contributing/bugs-and-features/#testing-pre-releases\"><span class=\"std std-ref\">How to test pre-release versions of Django</span></a> for more specific tips about catching\nregressions and reporting bugs.</p>\n</section>\n<section id=\"deployment\">\n<h2>Wdrażanie<a class=\"heading-anchor\" href=\"#deployment\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Jeśli jesteś dostatecznie pewny, że Twoja aplikacja działa z nową wersją Django, to możesz przejść dalej i <a class=\"reference internal\" href=\"/pl/6.1/howto/deployment/\"><span class=\"doc\">wdrożyć</span></a> swój ulepszony projekt Django.</p>\n<p>If you are using caching provided by Django, you should consider clearing your\ncache after upgrading. Otherwise you may run into problems, for example, if you\nare caching pickled objects as these objects are not guaranteed to be\npickle-compatible across Django versions. A past instance of incompatibility\nwas caching pickled <a class=\"reference internal\" href=\"/pl/6.1/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">HttpResponse</span></code></a> objects, either directly\nor indirectly via the <a class=\"reference internal\" href=\"/pl/6.1/topics/cache/#django.views.decorators.cache.cache_page\" title=\"django.views.decorators.cache.cache_page\"><code class=\"xref py py-func docutils literal notranslate\"><span class=\"pre\">cache_page()</span></code></a>\ndecorator.</p>\n</section>","rootId":"how-to-upgrade-django-to-a-newer-version","toc":[{"title":"Wymagane Czytanie","anchor":"required-reading","children":[]},{"title":"Zależności","anchor":"dependencies","children":[]},{"title":"Radzenie sobie z ostrzeżeniami o deprecjacji","anchor":"resolving-deprecation-warnings","children":[]},{"title":"Instalacja","anchor":"installation","children":[]},{"title":"Testowanie","anchor":"testing","children":[]},{"title":"Wdrażanie","anchor":"deployment","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"How-to guides","url":"/pl/6.1/howto/"}],"prev":{"docname":"howto/delete-app","title":"How to delete a Django application","url":"/pl/6.1/howto/delete-app/"},"next":{"docname":"howto/windows","title":"Jak zainstalować Django w systemie Windows","url":"/pl/6.1/howto/windows/"},"formats":{"html":"/pl/6.1/howto/upgrade-version/","markdown":"/pl/6.1/howto/upgrade-version.md","json":"/pl/6.1/howto/upgrade-version.json"},"source":"https://github.com/django/django/blob/stable/6.1.x/docs/howto/upgrade-version.txt","official":"https://docs.djangoproject.com/pl/6.1/howto/upgrade-version/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}